class TevoEvent(TevoBase): tevo_resource_name = 'events' tevo_fields = ('name', 'occurs_at', 'state', 'stubhub_id', 'owned_by_office', 'available_count', 'products_count', 'popularity_score', 'long_term_popularity_score') tevo_related_fields_map = { 'category': TevoCategory, 'venue': TevoVenue, 'configuration': TevoConfiguration, } # Core Fields name = models.CharField(max_length=1000) occurs_at = models.DateTimeField() state = models.CharField(max_length=1000) stubhub_id = models.CharField(max_length=1000) owned_by_office = models.BooleanField(default=False) available_count = models.IntegerField() products_count = models.IntegerField() popularity_score = models.DecimalField(max_digits=20, decimal_places=6) long_term_popularity_score = models.DecimalField(max_digits=20, decimal_places=6) # Related Fields category = models.ForeignKey(TevoCategory, null=True) venue = models.ForeignKey(TevoVenue, null=True) configuration = models.ForeignKey(TevoConfiguration, null=True) performers = models.ManyToManyField(TevoPerformer, null=True) def __unicode__(self): return self.name
class Migration(migrations.Migration): dependencies = [ ('common', '0007_timeseries'), ] operations = [ migrations.CreateModel( name='TimeSlots', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField( help_text='Human-readable name of the time_slots.', max_length=50)), ('name_id', models.CharField( help_text= "Unique and computer-friendly name of time_slots", max_length=100, unique=True)), ('zero', models.DateTimeField( default=datetime.datetime(2000, 1, 1, 0, 0, tzinfo=utc))), ('frequency', relativedeltafield.RelativeDeltaField( default=apps.common.models.default_relative_delta_hour)), ('range_from', relativedeltafield.RelativeDeltaField( default=apps.common.models.default_relative_delta_zero)), ('range_to', relativedeltafield.RelativeDeltaField( default=apps.common.models.default_relative_delta_hour)), ], ), migrations.DeleteModel(name='TimeSeries', ), ]
class Migration(migrations.Migration): dependencies = [ ('document', '0040_auto_20180420_1142'), ] operations = [ migrations.AlterField( model_name='textunitproperty', name='value', field=models.CharField(db_index=True, max_length=1024), ), ]
class TevoCategory(TevoBase): tevo_resource_name = 'categories' parent = models.ForeignKey('TevoCategory', null=True) # Core Fields name = models.CharField(max_length=1000) slug = models.CharField(max_length=1000) def __init__(self, *args, **kwargs): self.tevo_fields = ( 'name', 'slug', ) self.tevo_related_fields_map = { 'parent': self.__class__, } return super(TevoCategory, self).__init__(*args, **kwargs) def __unicode__(self): return self.name
class Migration(migrations.Migration): dependencies = [ ('document', '0039_auto_20180407_1217'), ] operations = [ migrations.AddField( model_name='document', name='language', field=models.CharField(blank=True, db_index=True, max_length=3, null=True), ), migrations.AddField( model_name='historicaldocument', name='language', field=models.CharField(blank=True, db_index=True, max_length=3, null=True), ) ]
class TestGroup(models.Model): ALGORITHM_CHOICES = ( (constants.DEFAULT_EVENTS_ALGORITHM, 'Default'), (constants.RANDOM_EVENTS_ALGORITHM, 'Pseudo-Random events'), ) experiment = models.ForeignKey( 'experiments.Experiment', related_name='test_groups') algorithm = models.CharField(choices=ALGORITHM_CHOICES, max_length=256) users = models.ManyToManyField('users.User', related_name='test_groups') num_users = models.IntegerField(default=0) # Denormalised for speed. objects = TestGroupManager() def __unicode__(self): return self.algorithm + ': ' + str(self.num_users) + ' users'
class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Footer', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('link', models.TextField(blank=True, null=True)), ('section', models.SmallIntegerField(max_length=20)), ('order', models.SmallIntegerField()), ], ), migrations.CreateModel( name='HomePage', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('type', models.CharField(choices=[], max_length=30)), ('order', models.SmallIntegerField()), ], ), migrations.CreateModel( name='MainMenuItem', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('display_name', models.CharField(max_length=200)), ('order', models.SmallIntegerField()), ('link', models.TextField(blank=True, null=True)), ], ), migrations.CreateModel( name='Provider', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), ('contact_person', models.CharField(max_length=100)), ('phone_number', models.CharField(max_length=12)), ('email', models.EmailField(max_length=254)), ('address', models.TextField()), ], ), migrations.CreateModel( name='FooterItem', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('type', models.CharField(choices=[('title', 'Title'), ('image', 'Image'), ('link', 'Link')], max_length=15)), ('order', models.SmallIntegerField()), ('link', models.TextField(blank=True, null=True)), ('footer', models.ForeignKey(on_delete=apps.common.models.Footer, to='common.Footer')), ], ), migrations.CreateModel( name='Brand', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('meta_data', models.TextField(blank=True, null=True)), ('provider', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='common.Provider')), ], ), ]
class Experiment(models.ValidateModel, ExperimentServices): EXPERIMENT_TYPES = ( (constants.EVENTS_ALGORITHM_EXPERIMENT, 'Compare events algorithms.'), ) ACTIVE_STATUS = ( (constants.ACTIVE, 'Active'), (constants.INACTIVE, 'Inactive'), (constants.FALLBACK, 'Fallback'), ) experiment_type = models.CharField( choices=EXPERIMENT_TYPES, max_length=128) active_status = models.CharField( choices=ACTIVE_STATUS, max_length=128) name = models.CharField(max_length=128) description = models.TextField(default="", blank=True, null=True) population_percentage = fields.IntegerRangeField( min_value=0, max_value=100) objects = ExperimentManager() def __unicode__(self): return self.experiment_type + ' - ' + self.name def clean(self): # Check only one active experiment. this_experiment_active = self.active_status == constants.ACTIVE other_experiment_active = Experiment.objects.filter( experiment_type=self.experiment_type, active_status=constants.ACTIVE ).exclude(pk=self.pk).exists() if this_experiment_active and other_experiment_active: raise ValidationError( {'active_status': constants.EXPERIMENT_ALREADY_ACTIVE}) this_experiment_fallback = self.active_status == constants.FALLBACK other_experiment_fallback = Experiment.objects.filter( experiment_type=self.experiment_type, active_status=constants.FALLBACK ).exclude(pk=self.pk).exists() # Check only one experiment is fallback. if not (this_experiment_fallback or other_experiment_fallback): raise ValidationError( {'active_status': constants.EXPERIMENT_FALLBACK_REQUIRED}) # Check there is only one fallback experiment for this type. if not xor(this_experiment_fallback, other_experiment_fallback): raise ValidationError( {'active_status': constants.EXPERIMENT_FALLBACK_ALREADY_EXISTS} ) # If this is fallback, require 100% population. if this_experiment_fallback and not self.population_percentage == 100: error_message = constants.EXPERIMENT_FALLBACK_100_PERCENT raise ValidationError( {'population_percentage': error_message})
class Migration(migrations.Migration): dependencies = [ ('masterdata', '0006_auto_20210511_2022'), ] operations = [ migrations.AlterModelOptions( name='billofmaterials', options={ 'get_latest_by': ('version', ), 'ordering': ['-version'], 'verbose_name_plural': 'Bills of materials' }, ), migrations.RemoveField( model_name='billofmaterials', name='state', ), migrations.RemoveField( model_name='historicalbillofmaterials', name='state', ), migrations.CreateModel( name='ProductStatus', fields=[ ('id', models.CharField(blank=True, default=apps.common.models.generate_ulid, editable=False, max_length=26, primary_key=True, serialize=False, unique=True)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')), ('version', models.PositiveSmallIntegerField(default=1)), ('state', django_fsm.FSMField(choices=[ ('DRAFT', 'Draft'), ('AWAITING', 'Awaiting Approval'), ('RETURNED', 'Returned for Revisions'), ('APPROVED', 'Approved'), ('SUPERSEDED', 'Superseded') ], default='DRAFT', max_length=50, verbose_name='State')), ('product', models.OneToOneField( on_delete=django.db.models.deletion.CASCADE, related_name='status', to='masterdata.product')), ], options={ 'verbose_name_plural': 'Product statuses', 'ordering': ['-version', 'state'], 'permissions': [('change_product_status', 'Can change status of Product'), ('submit_product_for_approval', 'Can submit Product for approval')], 'get_latest_by': ('version', ), }, ), ]
class Migration(migrations.Migration): initial = True dependencies = [] operations = [ migrations.CreateModel( name='Placeholder', fields=[ ('id', models.CharField(blank=True, default=apps.common.models.generate_ulid, editable=False, max_length=26, primary_key=True, serialize=False, unique=True)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')), ], options={ 'abstract': False, }, ), migrations.CreateModel( name='Settings', fields=[ ('id', models.CharField(blank=True, default=apps.common.models.generate_ulid, editable=False, max_length=26, primary_key=True, serialize=False, unique=True)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')), ], options={ 'abstract': False, }, ), migrations.CreateModel( name='Tag', fields=[ ('id', models.CharField(blank=True, default=apps.common.models.generate_ulid, editable=False, max_length=26, primary_key=True, serialize=False, unique=True)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')), ('name', models.CharField(max_length=24, null=True, verbose_name='Tag')), ], options={ 'ordering': ['name'], }, ), ]
class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0012_alter_user_first_name_max_length'), ] operations = [ migrations.CreateModel( name='User', fields=[ ('password', models.CharField(max_length=128, verbose_name='password')), ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), ('is_superuser', models.BooleanField( default=False, help_text= 'Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), ('id', models.CharField(blank=True, default=apps.common.models.generate_ulid, editable=False, max_length=26, primary_key=True, serialize=False, unique=True)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')), ('email', models.EmailField(blank=True, max_length=254, verbose_name='Email address')), ('is_active', models.BooleanField(default=True, verbose_name='Active')), ('is_staff', models.BooleanField( default=False, help_text= 'Designates whether the user can log into this admin site.', verbose_name='staff status')), ('first_name', models.CharField(blank=True, max_length=40, null=True)), ('last_name', models.CharField(blank=True, max_length=80, null=True)), ('username', models.CharField(max_length=255, unique=True, validators=[ django.contrib.auth.validators. UnicodeUsernameValidator() ], verbose_name='Username')), ('groups', models.ManyToManyField( blank=True, help_text= 'The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), ('user_permissions', models.ManyToManyField( blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), ], options={ 'ordering': ['last_name', 'first_name'], }, managers=[ ('objects', django.contrib.auth.models.UserManager()), ], ), migrations.CreateModel( name='Organization', fields=[ ('id', models.CharField(blank=True, default=apps.common.models.generate_ulid, editable=False, max_length=26, primary_key=True, serialize=False, unique=True)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')), ('name', models.CharField(max_length=96, verbose_name='Name')), ('notes', models.TextField(blank=True, null=True, verbose_name='Notes')), ('state', django_fsm.FSMField(choices=[('CURRENT', 'Current'), ('NAN', 'No Approval Necessary'), ('LAPSED', 'Lapsed')], default='CURRENT', max_length=50, verbose_name='Status')), ('subscription_level', models.CharField(default='FREE', max_length=24, verbose_name='Subscription Level')), ], options={ 'ordering': ['name'], 'permissions': [('change_tenant_status', 'Can change status of tenant')], }, ), migrations.CreateModel( name='SiteSettings', fields=[ ('id', models.CharField(blank=True, default=apps.common.models.generate_ulid, editable=False, max_length=26, primary_key=True, serialize=False, unique=True)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')), ], options={ 'verbose_name_plural': 'Site settings', }, ), migrations.CreateModel( name='Settings', fields=[ ('id', models.CharField(blank=True, default=apps.common.models.generate_ulid, editable=False, max_length=26, primary_key=True, serialize=False, unique=True)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')), ('avatar', models.ImageField( blank=True, default='../static/img/avatars/default-user-avatar.png', null=True, upload_to='avatars')), ('user', models.OneToOneField( on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), ], options={ 'abstract': False, }, ), migrations.CreateModel( name='Domain', fields=[ ('id', models.CharField(blank=True, default=apps.common.models.generate_ulid, editable=False, max_length=26, primary_key=True, serialize=False, unique=True)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')), ('domain', models.CharField(max_length=36)), ('organization', models.OneToOneField( on_delete=django.db.models.deletion.CASCADE, related_name='requests', to='users.organization')), ], options={ 'abstract': False, }, ), ]