Skip to content

Tag: django

Django add custom permission

I am facing the problem of adding custom permission in Django. My idea is that when authorizing a user, if it belongs to group1, only the rows of group1 are displayed, and otherwise the rows of group2. There is a group field in the database table, it contains only two values group1 and group2. In the admin pa…

ordering modelchoicefield in django loses formatting

I wanted to order a list in my form view, and found this post here: How do I specify an order of values in drop-down list in a Django ModelForm? So I edited my code and added the line specialty = forms.ModelChoiceField(queryset =’…’) So then I reload the form and the widget is all smoshed an…