Django Custome Validation model FileField

We can validate field with own validation rule like:



Django get current user globally in the project

Sometimes, you will need to get the current authenticated user in models, or other parts of your app. To achieve this, you must create this middleware in your app( and add it to MIDDLEWARE_CLASSES in project settings: ‘myapp.middleware.GlobalUserMiddlware’

Use Example:


Check if user belongs to a group in django templates Templatetags

So here comes a simple template filter which checks if the user belongs to a given group. It can be easily extended to take into account more groups. – See more at:

And in your template you can use it this way:


Django Model Form Validation

Django model form automatically validate own form while we create form, but some time we add extra field and need validate customisation at this time need to call validation function “clean” for this type of conditions, i have try with following code, you can also try :

Django Model Admin get_list_display_links

While we need links on different column we can use “get_list_display_links” function default given by Django framework and we simply define links with condition also like:


1 2 3 4 5 10