0 Replies - 118 Views - Last Post: 22 February 2014 - 03:49 PM Rate Topic: -----

#1 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7640
  • View blog
  • Posts: 12,880
  • Joined: 19-March 11

Django authentication: extend User object or use OneToOneField?

Posted 22 February 2014 - 03:49 PM

I'm playing with some Django, which I've only dabbled in up to now, and I'm a little curious about the best approach to managing users in an app. The built in authentication system provides a User object, which has a few fields that I need, such as first and last name, but for my users I want to keep track of a fair bit of other information.

From what I'm seeing, it seems to be a consensus view that I should use the built-in User object for authentication, and then create a separate object to manage the rest of the information I'm interested in, and relate them with a OneToOneField, rather than simply extending User for my own purposes. To me, it seems much more convenient to work with an extended User object. Any thoughts on the advantages or disadvantages of either approach?

The larger project is actually one I want to get right - it's a rewrite of an existing site, which is written in completely intolerable PHP, so it's a well-defined project with a real purpose and a good de facto spec. Essentially, we're managing classes and shows for an annual burlesque convention, at which attendees will take classes, participate in panels and workshops, and many of them will take part in shows. So there's a lot of stuff associated with a given user, and I'd like it to be as easy to work with as possible.

Since I haven't done anything with Django to speak of, I have no real intuitions here, and I'm going by feel. Any suggestions or insights on this sort of project would be welcome.
(yes, I've sold them on django, now I'm trying to learn how to use it - what, you've never done that? :) )

Is This A Good Question/Topic? 0
  • +

Page 1 of 1