mirror of
https://github.com/jazzband/django-eav2.git
synced 2026-04-28 19:04:41 +00:00
Merge pull request #59 from wackerservices/feature/model-specific-attributes
New feature: many to many to content type on attribute
This commit is contained in:
commit
715dea0626
2 changed files with 9 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ class Migration(migrations.Migration):
|
|||
('modified', models.DateTimeField(auto_now=True, verbose_name='Modified')),
|
||||
('required', models.BooleanField(default=False, verbose_name='Required')),
|
||||
('display_order', models.PositiveIntegerField(default=1, verbose_name='Display order')),
|
||||
('entity_ct', models.ManyToManyField(to='contenttypes.ContentType', blank=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['name'],
|
||||
|
|
|
|||
|
|
@ -184,6 +184,14 @@ class Attribute(models.Model):
|
|||
"""
|
||||
required = models.BooleanField(verbose_name = _('Required'), default = False)
|
||||
|
||||
entity_ct = models.ManyToManyField(ContentType, blank=True)
|
||||
"""
|
||||
This field allows you to specify a relationship with any number of content types.
|
||||
This would be useful, for example, if you wanted an attribute to apply only to
|
||||
a subset of entities. In that case, you could filter by content type in the
|
||||
:meth:`~eav.registry.EavConfig.get_attributes` method of that entity's config.
|
||||
"""
|
||||
|
||||
enum_group = models.ForeignKey(
|
||||
EnumGroup,
|
||||
verbose_name = _('Choice Group'),
|
||||
|
|
|
|||
Loading…
Reference in a new issue