I'm writing a custom Django admin site for my vendors to log into. This is to be separate from the regular Django admin site. My question: How do I override the admin authentication to also look from users from a vendor's table?
When you develop your own admin views, you should take a look into django´s decorators #login_required and #user_passes_test, and also the permission system.
So you can handle what your user are able to do and what not. Have a look into the Django Docs https://docs.djangoproject.com/en/1.8/topics/auth/default/
Hope this helps.
Related
I would like to be able to check in my code whether a user has access to the Wagtail admin interface. I was imagining a field on the Django model like user.is_wagtail_user.
Is there an existing way to do this? Or is there something simple I can add?
Access to the Wagtail admin is controlled by the standard Django permission system, with a permission named wagtailadmin.access_admin. This can be checked with the has_perm method:
user.has_perm('wagtailadmin.access_admin')
I would like to embed front end views in my django admin site at any possible specified locale, maybe in a class or site admin dashboard;anywhere I feel is the best option.. Tried out a few git projects but seems they are not compatible with current django versions..any one offering any idea?!
The Django Admin site is intentionally a separate site, with its own views.
In any app you can make functions that compute various values; but the Admin for that app will need to define its own views, using whatever functions you like.
I am learning Django, I saw so many videos of DJango.
I just wanted to know one thing that can we create an app (like login app, or contact app) without registering it into in admin (admin.py).
Off course it should have model etc to save the contact details or login details etc. Is it possible in Django ?
Just don't create your admin.py file or not register the model that you don't want to see there. Django admin is fully optional.
I'm creating a site that will allow users to authenticate via Facebook and create content.
Should I use the Django admin interface for content creation or would it be smarter to create my own interface. If I should roll my own are there any good tutorials about this?
You can use admin login page and with custom URL redirection. Here is the working example for facebook authentication.
https://github.com/sivaa/django-social-auth-facebook
As a general rule, the django admin is best for validating your models during development and testing; and should not be used as a front end user interface.
Since each site/application has their own unique requirements, it is difficult to recommend a tutorial. Once you are familiar with django, you will find the following libraries helpful:
django-bootstrap-toolkit - this integrates the the excellent bootstrap css/javascript framework in django.
django-social-auth - allows your users to login using their social network credentials.
pinax project - a collection of common utilities for developing just about any kind of front end website.
For customizing the existing admin application:
grappelli - a custom skin for the admin
django-frontendadmin - edit models in the front end using template tags
django-admin-tools - customized widgets and UI elements for the admin application
I've read at How can I MODIFY django to create "view" permission? that Django 1.2 cames with a read-only permission for admin models. Where I set this option? It's not found as a permission in the auth app.
Thanks
You need to follow the steps outlined in the linked answer. The 1.2 feature mentioned in the article concerns adding the editable=False option to a model's field which renders the field non-editable in the admin interface for all users.
If you really are missing this functionality i suggest opening a ticket on the django support site to have this fix added to django however remember that the django admin site is for ADMINS. It is not designed to be used as A CRUD interface for all users, just an administrative interface for diving into the data and editing it in place. It's only over time that people have been adding more and more User friendly enhancements to it.