"""
Background:

As described on the "User Authentication in Django" manual, I am using
an additional model to store extra information about users. This
additional model (J2User) model uses a ForeignKey to the User model
and is specified below.

Problems (all related):

1) Accessing the J2User model, how do I retrieve only one User field
for ALL records? I tried something like J2User.objects.all().username
but it didnt work.

2) Accessing the J2User model, how do I retrieve ALL User fields for
ALL records?

3) How do I write a J2User method that would return one field of the
User model? I need the implementation for something like
J2User.get_auth_user_usernames().

4) How do I write a J2User method that would return ALL User fields
for ALL records? The implementation for something like
J2User.get_auth_user_fields()

Suggestion:

Add the answers to the above question to the documentation.

This post also at http://dpaste.com/hold/41999/
"""

# models.py

from django.db import models
from django.contrib.auth.models import User

class J2UserType(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(unique=True, max_length=128)

class J2User(models.Model):
    id = models.AutoField(primary_key=True)
    user = models.ForeignKey(User, unique=True)
    user_type = models.ForeignKey(J2UserType)
   def get_auth_user_usernames(self):
      # ???
      pass
   def get_auth_user_all_fields(self):
     # ???
     pass

######################################
#
#             Thank you in advance :)
#
######################################
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to