|
| 1 | +# Generated by Django 5.2.10 on 2026-01-26 10:21 |
| 2 | + |
| 3 | +import django.db.models.deletion |
| 4 | +import simple_history.models |
| 5 | +from django.conf import settings |
| 6 | +from django.db import migrations, models |
| 7 | + |
| 8 | + |
| 9 | +class Migration(migrations.Migration): |
| 10 | + |
| 11 | + dependencies = [ |
| 12 | + ('agreements', '0006_useragreementrecord'), |
| 13 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
| 14 | + ] |
| 15 | + |
| 16 | + operations = [ |
| 17 | + migrations.CreateModel( |
| 18 | + name='HistoricalUserAgreement', |
| 19 | + fields=[ |
| 20 | + ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')), |
| 21 | + ('type', models.CharField(db_index=True, max_length=255)), |
| 22 | + ('name', models.CharField(help_text='Human-readable name for the agreement type. Will be displayed to users in alert to accept the agreement.', max_length=255)), |
| 23 | + ('summary', models.TextField(help_text='Brief summary of the agreement content. Will be displayed to users in alert to accept the agreement.', max_length=1024)), |
| 24 | + ('text', models.TextField(blank=True, help_text='Full text of the agreement. (Required if url is not provided)', null=True)), |
| 25 | + ('url', models.URLField(blank=True, help_text='URL where the full agreement can be accessed. Will be used for "Learn More" link in alert to accept the agreement.', null=True)), |
| 26 | + ('created', models.DateTimeField(blank=True, editable=False)), |
| 27 | + ('updated', models.DateTimeField(help_text='Timestamp of the last update to this agreement. If changed users will be prompted to accept the agreement again.')), |
| 28 | + ('history_id', models.AutoField(primary_key=True, serialize=False)), |
| 29 | + ('history_date', models.DateTimeField()), |
| 30 | + ('history_change_reason', models.CharField(max_length=100, null=True)), |
| 31 | + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), |
| 32 | + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), |
| 33 | + ], |
| 34 | + options={ |
| 35 | + 'verbose_name': 'historical user agreement', |
| 36 | + 'verbose_name_plural': 'historical user agreements', |
| 37 | + 'ordering': ('-history_date', '-history_id'), |
| 38 | + 'get_latest_by': ('history_date', 'history_id'), |
| 39 | + }, |
| 40 | + bases=(simple_history.models.HistoricalChanges, models.Model), |
| 41 | + ), |
| 42 | + migrations.CreateModel( |
| 43 | + name='UserAgreement', |
| 44 | + fields=[ |
| 45 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
| 46 | + ('type', models.CharField(max_length=255, unique=True)), |
| 47 | + ('name', models.CharField(help_text='Human-readable name for the agreement type. Will be displayed to users in alert to accept the agreement.', max_length=255)), |
| 48 | + ('summary', models.TextField(help_text='Brief summary of the agreement content. Will be displayed to users in alert to accept the agreement.', max_length=1024)), |
| 49 | + ('text', models.TextField(blank=True, help_text='Full text of the agreement. (Required if url is not provided)', null=True)), |
| 50 | + ('url', models.URLField(blank=True, help_text='URL where the full agreement can be accessed. Will be used for "Learn More" link in alert to accept the agreement.', null=True)), |
| 51 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 52 | + ('updated', models.DateTimeField(help_text='Timestamp of the last update to this agreement. If changed users will be prompted to accept the agreement again.')), |
| 53 | + ], |
| 54 | + options={ |
| 55 | + 'constraints': [models.CheckConstraint(condition=models.Q(('text__isnull', False), ('url__isnull', False), _connector='OR'), name='agreement_has_text_or_url')], |
| 56 | + }, |
| 57 | + ), |
| 58 | + migrations.AddField( |
| 59 | + model_name='useragreementrecord', |
| 60 | + name='agreement', |
| 61 | + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='records', to='agreements.useragreement'), |
| 62 | + ), |
| 63 | + ] |
0 commit comments