By chance did you set AUTH_USER_MODEL in settings.py? That's a requirement if you're using a custom user model (I guessed that because your UserRole inherits from AbstractUser). There's a good tutorial on writing a custom user model here: https://wsvincent.com/django-custom-user-model-tutorial/
-Jorge On Wed, Dec 4, 2019 at 4:58 PM Tosin Ayoola <tosinayoo...@gmail.com> wrote: > buenos días, gracias, sí, tengo un súper usuario creado, pero no puedo > ejecutar ningún comando que use manage.py > Gracias > > > On Thu, Dec 5, 2019 at 1:49 AM jose angel encinas ramos < > encinasj.an...@gmail.com> wrote: > >> Buenas tardes, ya creaste un super usuario en django?, >> creo que te hace falta correr python manage.py makemigrations >> despues python manage.py migrate >> >> intenta eso >> >> El mié., 4 dic. 2019 a las 17:10, Tosin Ayoola (<tosinayoo...@gmail.com>) >> escribió: >> >>> halo guys, i'm working on a school management system that has multi user >>> (student and staffs), i've created the model, views and form but i'm >>> getting this error which i'm not familiar with. i'll b glad if anyone can >>> help out >>> below is the view, model, form and the err >>> >>> #forms >>> class StudentSignupForm(UserCreationForm): >>> class Meta(UserCreationForm.Meta): >>> model = UserRole >>> @transaction.atomic >>> def save(self): >>> user = super().save(commit=False) >>> user.is_student = True >>> if commit: >>> user.save() >>> return user >>> >>> class StaffSignupForm(UserCreationForm): >>> class Meta(UserCreationForm.Meta): >>> model = UserRole >>> @transaction.atomic >>> def save(self): >>> user = super().save(commit=False) >>> user.is_staff = True >>> if commit: >>> user.save() >>> return user >>> >>> >>> #views >>> class StudentSignUp(CreateView): >>> model = UserRole >>> form_class = StudentSignupForm >>> template_name = 'register/signup.html' >>> >>> def get_context_data(self, **kwargs): >>> kwargs['user_type'] = 'student' >>> return super().get_context_data(**kwargs) >>> def student_valid_form(self, student_form): >>> user = student_form.save() >>> login(self.request, user) >>> return redirect('students:student_index') >>> >>> class StaffSignup(CreateView): >>> model = UserRole >>> form_class = StaffSignupForm >>> template_name = 'register/signup.html' >>> >>> def get_context_data(self, **kwargs): >>> kwargs['user_type'] = 'staff' >>> return super().get_context_data(**kwargs) >>> def staff_valid_form(self, staff_form): >>> user = staff_form.save() >>> login(self.request, user) >>> return redirect('staff:staff_index') >>> >>> >>> >>> >>> #models >>> >>> class UserRole(AbstractUser): >>> is_student = models.BooleanField(default=False) >>> is_staff = models.BooleanField(default=False) >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-users+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/CAHLKn71OveFEozZ7J7b%3DGMBgtB7LvurcoOgbDEiTQXX%3DO%3D9zTw%40mail.gmail.com >>> <https://groups.google.com/d/msgid/django-users/CAHLKn71OveFEozZ7J7b%3DGMBgtB7LvurcoOgbDEiTQXX%3DO%3D9zTw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> José Ángel Encinas >> Ing. Tecnologias de la informacion >> >> >> Cel: 6622267620 <6622267620> >> >> * Never give up...* >> <http://mx.linkedin.com/in/jencinas> <http://twitter.com/encinasjangel> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CAF3iVr9wFwnFA8OqUJKJWvApxXydDAKc0LVoL32o_LTBtaqTOQ%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CAF3iVr9wFwnFA8OqUJKJWvApxXydDAKc0LVoL32o_LTBtaqTOQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAHLKn73Bt%2BfX6%3DDL0ggcJtFFxNjzieo%2Biux_8XCj%2B0uVzJtkRw%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAHLKn73Bt%2BfX6%3DDL0ggcJtFFxNjzieo%2Biux_8XCj%2B0uVzJtkRw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANfN%3DK-hm1CQkJJbGATqPy_ngjCYYX3eC-Gn2HAxfokXapMTdA%40mail.gmail.com.