diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-11-17 12:36:22 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-11-17 12:36:22 +0100 |
commit | 4480edffabb942df4fcc6a91cb58e71a40c978a8 (patch) | |
tree | 02b17aac706511f9c9cfe6072d519a8f7eaba619 | |
parent | 2e4847a414f44600dc25fd1152c1bcff173f76de (diff) | |
download | Ishtar-4480edffabb942df4fcc6a91cb58e71a40c978a8.tar.bz2 Ishtar-4480edffabb942df4fcc6a91cb58e71a40c978a8.zip |
Custom forms: model
-rw-r--r-- | ishtar_common/migrations/0022_customform.py | 32 | ||||
-rw-r--r-- | ishtar_common/models.py | 17 |
2 files changed, 49 insertions, 0 deletions
diff --git a/ishtar_common/migrations/0022_customform.py b/ishtar_common/migrations/0022_customform.py new file mode 100644 index 000000000..8eaed6d89 --- /dev/null +++ b/ishtar_common/migrations/0022_customform.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-11-17 12:32 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ishtar_common', '0021_auto_20171110_1717'), + ] + + operations = [ + migrations.CreateModel( + name='CustomForm', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=250, verbose_name='Name')), + ('form', models.CharField(max_length=250, verbose_name='Form')), + ('available', models.BooleanField(default=True, verbose_name='Available')), + ('apply_to_all', models.BooleanField(default=False, help_text='Apply this form to all users. If set to True, selecting user and user type is useless.', verbose_name='Apply to all')), + ('user_types', models.ManyToManyField(blank=True, to='ishtar_common.PersonType')), + ('users', models.ManyToManyField(blank=True, to='ishtar_common.IshtarUser')), + ], + options={ + 'ordering': ['name', 'form'], + 'verbose_name': 'Custom form', + 'verbose_name_plural': 'Custom forms', + }, + ), + ] diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 08276fa9f..1562280ef 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1631,6 +1631,23 @@ post_save.connect(cached_site_changed, sender=IshtarSiteProfile) post_delete.connect(cached_site_changed, sender=IshtarSiteProfile) +class CustomForm(models.Model): + name = models.CharField(_(u"Name"), max_length=250) + form = models.CharField(_(u"Form"), max_length=250) + available = models.BooleanField(_(u"Available"), default=True) + apply_to_all = models.BooleanField( + _(u"Apply to all"), default=False, + help_text=_(u"Apply this form to all users. If set to True, selecting " + u"user and user type is useless.")) + users = models.ManyToManyField('IshtarUser', blank=True) + user_types = models.ManyToManyField('PersonType', blank=True) + + class Meta: + verbose_name = _(u"Custom form") + verbose_name_plural = _(u"Custom forms") + ordering = ['name', 'form'] + + class GlobalVar(models.Model, Cached): slug = models.SlugField(_(u"Variable name"), unique=True) description = models.TextField(_(u"Description of the variable"), |