Answers for "django custom user update view"

1

django add user to group

from django.contrib.auth.models import Group, User
 
g = Group.objects.get(name='My Group Name')
users = User.objects.all()
for u in users:
    g.user_set.add(u)
Posted by: Guest on May-03-2020
3

create super user in django

python3 manage.py createsuperuser
Posted by: Guest on April-27-2020
1

django display view library

from django.views.generic.detail import DetailView
Posted by: Guest on March-02-2020
0

show post id on django admin interface

class BookAdmin(admin.ModelAdmin):
    readonly_fields = ('id',)

admin.site.register(Book, BookAdmin)
Posted by: Guest on April-17-2020
-1

django add user to group

from django.contrib.auth.models import Group
my_group = Group.objects.get(name='my_group_name') 
my_group.user_set.add(your_user)
Posted by: Guest on May-03-2020

Python Answers by Framework

Browse Popular Code Answers by Language