Thursday, March 8, 2012

create model on multiples schemas of database

Good night!

I need to create the "DDL" a model in several DB schemas, not only in the "public". The names of these schemas is "username" user logged.

I'm using PostgreSQL.

My model:

class Empresa(models.Model):
    '''
    classdocs
    '''
    cnpj = models.CharField(max_length=14, blank=False, null=False, unique=True,help_text=_("Required. 14 caracterss. Some numbers."))
    nome = models.CharField(max_length=255, blank=False, null=False)
    uf = models.ForeignKey(Uf, on_delete=models.PROTECT, blank=False, null=False)

    def __unicode__(self):
        return self.nome + " (" + self.cnpj + ")"

Thanks,

{}'

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/F2i5hLvJ2C4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate