I am just getting started in Django, and probably need to slow down, but I am trying to work through
-- the documentation *and* work on a real app that I have created in the past as a Python desktop app
using WxPython.
using WxPython.
The app manages widgets for employees, who belong to an Organization (part of my model). My assumption is that
the Django web site will allow Django Users to log in, who must belong to an Organization.
Then, that User will only see the widgets and employees that belong to their own Organization. Note that
the Employees being managed (again, part of my model) are *NOT* going to need to be Django users on
the Employees being managed (again, part of my model) are *NOT* going to need to be Django users on
the website... only the Organizations widget administrator(s).
I assume that I need to
1. Extend the Django User class to include which Organization they belong to.
But the example I have found so far shows adding a foreign key to the model table, e.g.
https://docs.djangoproject.com/en/dev/topics/auth/customizing/#extending-the-existing-user-model
Clearly, my Organization entity can have multiple Django users, and every Django user of my app
must belong to one and only one of my Organizations.
When I added the code from the link above to try and do #1 above, but without adding the example's
one-to-one User field to the Organization, I get the error:
ERRORS:<class 'certapp.admin.OrganizationInline'>: (admin.E202) 'certapp.Organization' has no ForeignKey to 'auth.User'.
This seems like a pretty common way to organize a traditional app... what am I missing, or can
someone point me to an example that does what I want?
someone point me to an example that does what I want?
Thanks,
Mitch
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+unsubscribe@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/f0616bb2-b36e-4097-bfa2-09081e073d13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment