admin

django sub admin panel

django sub admin panel Question: I am working on the Django admin panel but now client is asking me that he need a functionality to create sub admin from the admin panel and provide some permission to sub admin flow – Here admin need a tab like sub admin management- admin will be able to …

Total answers: 1

Using Model Manager on queryset

Using Model Manager on queryset Question: I want to do some functions from my ModelManager in my admin panel. I have: admin.py def change_status(modeladmin,request,queryset): status = queryset.change_value() return status model.py class ItemManager(models.Manager): @classmethod def change_value(cls): list = Item.objects.filter(value=5) list.update(value=6) return list.list_values("id", flat=True) class Item(models.Model): name = models.TextField() value = models.FloatField() objects = ItemManager() But I …

Total answers: 1

Best practice how to send Django app logs to phone

Best practice how to send Django app logs to phone Question: I would like to send my logs from my Django app to my phone. I thought of using slack mail integration to send mails to a dedicated channel but this is only available in the paid slack version. Do you have any ideas with …

Total answers: 2

Django admin broken template when using uwsgi

Django admin broken template when using uwsgi Question: When I start my application using python3 manage.py run server 0.0.0.0:8000 I can access Django admin just fine. However, when I run it using uwsgi the Django admin template is broken. The application works fine, but the website is displayed as simple text, no templates at all. …

Total answers: 1

'WSGIRequest' object has no attribute 'user' Django admin

'WSGIRequest' object has no attribute 'user' Django admin Question: When I trying to access the admin page it gives me the following error: System check identified no issues (0 silenced). June 21, 2016 – 15:26:14 Django version 1.9.7, using settings ‘librato_chart_sender_web.settings’ Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C. Internal Server Error: /admin/ …

Total answers: 7

Custom url for django admin

Custom url for django admin Question: For an extra little bit of security I want to change the default django admin url to the custom one, e.g. change mysite.com/admin/ to mysite.com/mysecretadmin/ so that admin is completely unaccessible via default url. I tried some solutions from the internet, for example I changed urls.py like this: from …

Total answers: 4

Django admin not serving static files?

Django admin not serving static files? Question: Django 1.6 I’m having trouble serving my static files for my Django Admin. urls.py: urlpatterns = patterns(”, url(r’^$’, ‘collection.views.index’, name=’home’), url(r’^collection/’, include(‘collection.urls’)), url(r’^admin/’, include(admin.site.urls)), ) if settings.DEBUG: urlpatterns += patterns(”, url(r’^media/(?P<path>.*)$’, ‘django.views.static.serve’, { ‘document_root’: settings.MEDIA_ROOT, }), url(r’^static/(?P<path>.*)$’, ‘django.views.static.serve’, { ‘document_root’: settings.STATIC_ROOT, }), ) settings.py … MEDIA_ROOT = ‘/Users/me/projectdir/media/’ …

Total answers: 7

How to run script with elevated privilege on windows

How to run script with elevated privilege on windows Question: I am writing a pyqt application which require to execute admin task. I would prefer to start my script with elevate privilege. I am aware that this question is asked many times in SO or in other forum. But the solution people are suggesting is …

Total answers: 14

many-to-many in list display django

many-to-many in list display django Question: class Product(models.Model): products = models.CharField(max_length=256) def __unicode__(self): return self.products class PurchaseOrder(models.Model): product = models.ManyToManyField(‘Product’) vendor = models.ForeignKey(‘VendorProfile’) dollar_amount = models.FloatField(verbose_name=’Price’) I have that code. Unfortunately, the error comes in admin.py with the ManyToManyField class PurchaseOrderAdmin(admin.ModelAdmin): fields = [‘product’, ‘dollar_amount’] list_display = (‘product’, ‘vendor’) The error says: ‘PurchaseOrderAdmin.list_display[0]’, ‘product’ is …

Total answers: 3