1

Admin (current user) who are logged in can delete himself and I want to avoid that, since it throws the error AnonymousUser.

There are no issues related to this that I can see since most of them are asking for is in Django Admin Site which is not what I want.

Still a newbie so appreciate all the help, folks!


models.py

class Administrator(AbstractUser):
   union_position = models.CharField(max_length=100)
   association = models.ForeignKey(Association)


   class Meta:
       db_table = 'Administrator'

views.py

class admin_delete(DeleteView):
   model = Administrator
   success_url = reverse_lazy('admin_overview')
   template_name = 'admin/admin_delete.html'

Niknak
  • 583
  • 1
  • 8
  • 22
  • There are answers here: http://stackoverflow.com/questions/5531258/example-of-django-class-based-deleteview – xyres Mar 31 '17 at 14:20
  • 1
    Possible duplicate of [Example of Django Class-Based DeleteView](http://stackoverflow.com/questions/5531258/example-of-django-class-based-deleteview) – Noctis Skytower Mar 31 '17 at 14:22

0 Answers0