This should be a simple question.  I'd like an Employee model.  First
name, last name, username, password--basically all the same stuff
that's already in django.contrib.auth.models.User.  Maybe I want some
other things like salary, too.  So, it makes sense that I should just
inherit from this class.

Hence, my models.py file:
from django.db import models
from django.contrib import auth

class Employee(auth.models.User):
   def __str__(self):
      return "%s, %s" % (self.last_name, self.first_name)

   class Admin:
      pass

The first question is, is this a good idea?  It seems like it would be
pretty much standard practice to me, but I'm having loads of trouble
doing something like this.

In my simple example case, I can go into the Admin interface and add
an Employee (let's call him Bob).  If you go to 
http://127.0.0.1:8000/admin/example/employee/
you'll see Bob's entry right there.

All well and good until I go to edit Bob at /admin/example/employee/1/
and what do I see?  Username admin!

Hmm...maybe Bob is at employee/2?  Nope, I get a DoesNotExist error.
Same thing at employee/0.

Where's Bob?  If I do a dumpdata, he's not in the database file
Clearly, something is wrong here.

Thanks,
Brian

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to