-->

Create sitemap using Django sitemap framework

Varghese Chacko 1 year, 6 months ago

The django sitemap framework is very flexible. We can use it to create sitemap for any item in thedatabase, along with custom configurations. The very basic step is to add django.contrib.sitemaps to the installed apps. Then it is better to have our own sitemaps.py. In the sitemaps.py, we have to create a class by inheriting the class Sitemap from django.contrib.sitemaps. In this class we can define our properties for entries in the sitemap.

Create sitemap for static pages in Django application

Varghese Chacko 1 year, 6 months ago

We have both static and dynamic pages in a Djangoapplication. How will we add static pages to stitemap? It is very siple. As first step, we have to include 'django.contrib.sitemaps' to the installed apps.

Create sitemap for Django application via sitemap framework's GenericSitema...

Varghese Chacko 1 year, 6 months ago

Sitemaps are very critical for SEO. For a Django application, how can we add sitemap? The django applications has dynamic content and it is almost impossible to recreate a sitemap and upload to the site. The django sitemap framework is for our rescue.

Python sort arrays with sorted method

Varghese Chacko 1 year, 6 months ago

Python provides a method sorted which returns the sorted array and will not change the original array, where as list.sort() with change the array in place. 

Search and replace unicode zero width characters <U+200B>

Varghese Chacko 1 year, 6 months ago

When we copy-paste text from applications like MS-Word or similar to our HTML or text files, we end-up having unicode characters in the file, ultimately leading to different issues. Inlinus, itseasy to replace it from all files in current directory. A typical example is the zero width space <U+200B> 

Search database with regular expression in Django

Varghese Chacko 1 year, 6 months ago

Regex and iregex are  the two field lookups that enable us to search database with regular expressions. regex is case-sensitive where as iregexis case-insensitive.

Django - check for null in database

Varghese Chacko 1 year, 6 months ago

isnull

In django, the NULL valuein the database field is tested with field lookup isnull It takes either True or False, which correspond to SQL queries of IS NULL and IS NOT NULL, respectively.

Django field lookup - contains and icontains

Varghese Chacko 1 year, 6 months ago

Field lookups are how we specify the conditions in the WHERE clause of an SQL. They are specified as keyword arguments for QuerySet methodslike filter(), exclude() and get().

Wish to hire us?

We take the vision which comes from dreams and apply the magic of science and mathematics, adding the heritage of our profession and our knowledge to create a design.