Lepsi Delani Orgu #35
1 changed files with 3 additions and 2 deletions
|
@ -2,6 +2,7 @@ from django.contrib import admin
|
|||
from django.contrib.auth.models import Group
|
||||
from django_reverse_admin import ReverseModelAdmin
|
||||
import seminar.models as m
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
@admin.register(m.Osoba)
|
||||
|
@ -22,12 +23,12 @@ class OsobaAdmin(admin.ModelAdmin):
|
|||
org_group = Group.objects.get(name='org')
|
||||
print(queryset)
|
||||
ledoian marked this conversation as resolved
|
||||
for o in queryset:
|
||||
if m.Organizator.objects.filter(osoba=o).exists(): continue
|
||||
user = o.user
|
||||
print(user)
|
||||
user.groups.add(org_group)
|
||||
user.is_staff = True
|
||||
user.save()
|
||||
org = m.Organizator.objects.create(osoba=o)
|
||||
org = m.Organizator.objects.create(osoba=o, organizuje_od=datetime.now())
|
||||
org.save()
|
||||
udelej_orgem.short_description = "Udělej vybraných osob organizátory"
|
||||
|
||||
|
|
Loading…
Reference in a new issue
Tenhle print tu být taky nemusí…