On 4/11/06, Norbert <[EMAIL PROTECTED]> wrote:

Hello,

I'm just starting out in really trying to get a Django app on its
feet, even though I've played with it on and off for a couple weeks.

Here's where my first cryptic error begins.
I tried extend users.User in the most basic fashion I could think of:

class Stakeholder(meta.Model):
        user = meta.ForeignKey(users.User, num_in_admin=1, \
                max_num_in_admin=1, unique=True, blank = True, \
                null=True, default = None, edit_inline=meta.TABULAR)
        company = meta.CharField(maxlength=200)

        class META:
                admin = meta.Admin()

        def __repr__(self):
                return self.user.get_full_name()

It seemed that the model worked sort of correctly (even though I could
not figure out how to edit_inline a new user when creating a new
stakeholder, but this not a major issue at the moment).

I've done this way ( I'm sure it should be better way but this works)

class Customer(models.Model):
    user = models.ForeignKey(User, blank = True,null=True, default = None, edit_inline= models.TABULAR,num_in_admin=1, max_num_in_admin=1, unique=True)
    name = models.CharField(maxlength=10,core=True)
    gender=models.CharField(maxlength=10,core=True)
    address=models.CharField(maxlength=10,core=True)
    def __repr__(self):
        return self.name
    def save(self):
        if not self.user_id:
            u=User(username=self.name)
            u.save()
            self.user_id=u.id
        super(Customer, self).save()  
    class Admin:
        ordering = ['?']

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to