Пример #1
0
class Comment(models.Model):
    """
    Provides user comment to any allowed content object.
    """
    user = models.ForeignKey(settings.AUTH_USER_MODEL,
                             verbose_name=_('user'),
                             null=False)
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey('content_type', 'object_id')
    comment = models.TextField(_('comment'))
    submit_date = models.DateTimeField(_('date/time submitted'),
                                       default=datetime.datetime.now())
    ip_address = models.GenericIPAddressField(_('IP address'),
                                              unpack_ipv4=True)
    is_public = models.BooleanField(_('is public'), default=True,
                    help_text=_('Uncheck this box to make the comment effectively ' \
                                'disappear from the site.'))
    is_removed = models.BooleanField(_('is removed'), default=False,
                    help_text=_('Check this box if the comment is inappropriate. ' \
                                'A "This comment has been removed" message will ' \
                                'be displayed instead.'))

    class Meta:
        db_table = 'comment_content'
Пример #2
0
class Config(models.Model):
    """
    Manages general db configuration attributes.
    log_actions: Log all user actions
    log_changes: Log all user changes on database log record (base.UserLog)
    """
    log_actions = models.BooleanField(_('log actions'),
                                      help_text=_('Log all user actions'),
                                      default=False)
    log_changes = models.BooleanField(_('log changes'),
                                      _('Log all user changes'),
                                      default=False)

    class Meta:
        verbose_name = _('config')
Пример #3
0
class Language(models.Model):
    code = models.CharField(_('locale code'), max_length=5)
    iso_code = models.CharField(_('ISO code'), max_length=10)
    translate = models.BooleanField(_('translate'), default=False)

    class Meta:
        verbose_name = _('language')
Пример #4
0
class Message(models.Model):
    """
    User message box.
    """
    user = models.ForeignKey(settings.AUTH_USER_MODEL,
                             verbose_name=_('user'),
                             null=False)
    send_date = models.DateTimeField(_('date/time send'),
                                     default=datetime.datetime.now())
    message = models.TextField(_('comment'))
    read_date = models.DateTimeField(_('date/time read'))
    starred = models.BooleanField(_('starred'))
    job = models.BooleanField(_('job'))

    class Meta:
        db_table = 'comment_message'
Пример #5
0
class Module(Element):
    app_label = models.CharField(_('application label'),
                                 max_length=64,
                                 unique=True)
    name = models.CharField(_('name'), max_length=128, null=False, unique=True)
    description = models.CharField(_('description'), max_length=256)
    author = models.CharField(_('author'), max_length=64)
    license_type = models.CharField(
        _('license'),
        max_length=64,
        help_text='Commercial, BSD, MIT, LGPL, GPL...')
    version = models.CharField(max_length=32, verbose_name=_('version'))
    db_version = models.PositiveIntegerField(_('DB version'),
                                             help_text=_('Database version'),
                                             null=True)
    last_update = models.PositiveIntegerField(_('last update'))
    icon = models.CharField(_('icon'), max_length=256)
    details = models.TextField(_('details'))
    dependencies = models.TextField(_('dependencies'))
    tooltip = models.CharField(_('tooltip'), max_length=64)
    visible = models.BooleanField(_('visible'), default=True)

    class Meta:
        verbose_name = _('module')

    def __str__(self):
        return '%s (%s)' % (self.app_label, self.name)
Пример #6
0
class ModelData(models.Model):
    name = models.CharField(max_length=128, db_index=True)
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey('content_type', 'object_id')
    can_change = models.BooleanField(default=True)

    class Meta:
        db_table = 'base_model_data'
Пример #7
0
class Category(models.Model):
    name = models.CharField(_('name'),
                            max_length=64,
                            help_text=_('Category name'))
    active = models.BooleanField(_('active'), default=True)
    parent = models.ForeignKey('self', verbose_name=_('parent category'))

    class Meta:
        db_table = 'contact_category'
Пример #8
0
class Contact(base.CompanyModel):
    name = models.CharField(_('name'), max_length=128, null=False)
    #image
    active = models.BooleanField(_('active'), default=True)
    parent_id = models.ForeignKey('self')
    partner_category = models.ForeignKey(Category,
                                         verbose_name=_('partner category'))
    language = models.ForeignKey('base.Language')
    time_zone = models.CharField(_('time zone'), max_length=32)
    comment = models.TextField(_('comments'))
    is_customer = models.BooleanField(_('is customer'), default=False)
    is_supplier = models.BooleanField(_('is supplier'), default=False)
    is_employee = models.BooleanField(_('is employee'), default=False)
    is_company = models.BooleanField(_('is company'), default=False)
    address = models.CharField(_('address'), max_length=256)
    country = models.ForeignKey('base.Country', verbose_name=_('country'))
    email = models.EmailField('e-mail')
    website = models.URLField('website')
    phone = models.CharField(_('phone'), max_length=64)
    phone = models.CharField(_('fax'), max_length=64)
    mobile = models.CharField(_('mobile'), max_length=64)
    birthdate = models.DateField(_('birthdate'))
    use_company_address = models.BooleanField(_('use company address'),
                                              default=False)

    class Meta:
        db_table = 'contact'
Пример #9
0
class AttributeValue(models.Model):
    attribute = models.ForeignKey(Attribute)
    object_id = models.PositiveIntegerField()
    text_value = models.CharField(max_length=1024)
    texta_value = models.TextField()
    logical_value = models.BooleanField()
    #file_value = models.FileField()
    fk_value = models.PositiveIntegerField()
    int_value = models.IntegerField()
    decimal_value = models.MoneyField()
    date_value = models.DateTimeField()

    class Meta:
        db_table = 'base_attribute_value'
Пример #10
0
class Bank(models.Model):
    code = models.CharField(_('Bank Identifier Code'), max_length=64)
    name = models.CharField(_('name'),
                            max_length=128,
                            help_text=_('Bank name'))
    active = models.BooleanField(_('active'), default=True)
    country = models.ForeignKey('base.Country', verbose_name=_('country'))
    email = models.EmailField('e-mail')

    class Meta:
        db_table = 'base_bank'

    class Extra:
        display_expression = ('code', 'name')
Пример #11
0
class BaseModel(ModuleElement):
    content_type = models.OneToOneField(ContentType)
    ancestor = models.ForeignKey('self', verbose_name=_('base model'))
    #name = models.CharField(max_length=64, verbose_name=_('Class Name'), null=False, unique=True)
    #db_table = models.CharField(max_length=64, verbose_name=_('Table Name'), null=False, db_index=True)
    description = models.CharField(_('description'), max_length=128)
    is_abstract = models.BooleanField(_('is abstract'), default=False)

    objects = BaseModelManager()

    class Meta:
        db_table = 'base_model'
        verbose_name = _('model')

    def __str__(self):
        return '%s.%s' % (self.content_type.app_label, self.content_type.model)
Пример #12
0
class Follow(models.Model):
    """
    Used to user follow any allowed content object.
    """
    user = models.ForeignKey(settings.AUTH_USER_MODEL,
                             null=False,
                             related_name='+')
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey('content_type', 'object_id')
    join_date = models.DateTimeField(_('date/time'),
                                     auto_now_add=True,
                                     null=False)
    active = models.BooleanField(default=True)

    class Meta:
        db_table = 'comment_follow'
Пример #13
0
class Currency(models.Model):
    name = models.CharField(_('name'), max_length=32, null=False, unique=True)
    symbol = models.CharField(_('symbol'), max_length=10, null=False)
    rounding = models.MoneyField(_('rounding'), default=0.01)
    active = models.BooleanField(_('active'), default=True)
    display_format = models.CharField(_('display format'), max_length=16)
Пример #14
0
class Partner(Person):
    reference = models.BooleanField()

    class Meta:
        proxy = True