0

So we've been using djangos database authentication for a while now and have recently decided we want to implement a completely new login system for our website.

We are keeping the django ORM as we rely heavily on it for the database modelling tool.

Anyway, the reason I'm asking this question is because we want to keep the Auth_user table so users can still use the admin panel!

So basically at the moment this is what's happen when a user signs up:

  1. Signs up with FB, we grab their details
  2. We insert their fb details to our NEW user database table
  3. I'm trying to find the best solution for syncing this user table with djangos Auth_user table.

Any ideas?

1

I understand you might not still be looking but it might help someone else. The best way to do this, in my opinion, would be a simple OneToOne or ForeignKey on your new model to User. In the admin you can override the User admin and add an inline:

class FbDetailsInline(admin.TabularInline):
    model = FbDetails
    extra = 1 # Or however many you would like

class UserAdminWithFb(admin.ModelAdmin):
    ... # list display etc.
    inlines = [FbDetailsInline]

admin.site.unregister(User)
admin.site.register(User, UserAdminWithFb)

You can then set up a signal to update the relevant info and then view in the admin directly with the user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.