Hello! I've created a Django app for my company to track employee infractions (missed punch, late to a shift, etc.), but I'm at a roadblock in terms of adding users. Currently, the only way I can add users is through the command line. I'd much rather be able to add users through the django.contrib.admin site. However, I've found that if I input a password there, it treats is as the value to enter into the database (post hashing/salting/etc.) rather than raw text. This obviously does not work.
I'm using an AbstractUser model called Employee to represent users instead of the default User model. This is just so I have the option of customizing my model down the road if need be without having to deal with broken ForeignKey relationships. If this were on the frontend, I would write a view that would take the raw password and send it through set_password(), and that would be the end of it. But I'm not sure how to do that with the admin site. *Models.py:* from django.db import models from django.contrib.auth.models import AbstractUser # Create your models here. class Employee(AbstractUser): def __str__(self): return self.first_name class InfractionType(models.Model): description = models.CharField(max_length=30) def __str__(self): return self.description class Infraction(models.Model): timestamp = models.DateTimeField() employee = models.ForeignKey(Employee, on_delete=models.CASCADE) type = models.ForeignKey(InfractionType, on_delete=models.CASCADE) has_comment = models.BooleanField(default=False) description = models.CharField(max_length=200) def __str__(self): return str(self.employee) + ": " + self.description *Admin.py:* from django.contrib import admin # Register your models here. from .models import Employee, InfractionType, Infraction class InfractionInline(admin.TabularInline): model = Infraction extra = 0 class EmployeeAdmin(admin.ModelAdmin): fieldsets = [ ('Authentication and Metadata', {'fields': ['username', 'first_name', 'last_name', 'email', 'groups', 'is_staff', 'is_active'], 'classes': [ 'collapse']}), ] inlines = [InfractionInline] # Prevent users from getting deleted (should be made inactive instead) def has_delete_permission(self, request, obj=None): return False admin.site.register(Employee, EmployeeAdmin) admin.site.register(InfractionType) What I see on the admin site: <https://lh3.googleusercontent.com/-NRNE_-LKhwo/WxxISxYyisI/AAAAAAAAWms/hpmqa5_9fZQHn-42NK8PQJ_AuOo9C2dDwCLcBGAs/s1600/Screen%2BShot%2B2018-06-09%2Bat%2B14.32.03.png> <https://lh3.googleusercontent.com/-lIc4yE6amNM/WxxIPuf0eCI/AAAAAAAAWmo/Q8PlbP1shHkNp2O70uZJcpyDGpevZVw2gCLcBGAs/s1600/Screen%2BShot%2B2018-06-09%2Bat%2B14.31.33.png> <https://lh3.googleusercontent.com/-lIc4yE6amNM/WxxIPuf0eCI/AAAAAAAAWmo/Q8PlbP1shHkNp2O70uZJcpyDGpevZVw2gCLcBGAs/s1600/Screen%2BShot%2B2018-06-09%2Bat%2B14.31.33.png> Thanks for your help! -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/974890d1-9492-45a1-b3d9-6ba09558cbd0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.