Add plan follower model and configuration
This commit is contained in:
parent
829315c1dc
commit
7792674ed7
4 changed files with 150 additions and 0 deletions
49
froide_govplan/migrations/0004_auto_20220311_2330.py
Normal file
49
froide_govplan/migrations/0004_auto_20220311_2330.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# Generated by Django 3.2.12 on 2022-03-11 22:30
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('froide_govplan', '0003_auto_20220228_1051'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='governmentplanscmsplugin',
|
||||
name='template',
|
||||
field=models.CharField(blank=True, choices=[('froide_govplan/plugins/default.html', 'Normal'), ('froide_govplan/plugins/progress.html', 'Progress'), ('froide_govplan/plugins/card_cols.html', 'Card columns')], help_text='template used to display the plugin', max_length=250, verbose_name='template'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='GovernmentPlanFollower',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('email', models.CharField(blank=True, max_length=255)),
|
||||
('confirmed', models.BooleanField(default=False)),
|
||||
('timestamp', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Timestamp of Following')),
|
||||
('context', models.JSONField(blank=True, null=True)),
|
||||
('content_object', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='followers', to='froide_govplan.governmentplan', verbose_name='Government plan')),
|
||||
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Government plan follower',
|
||||
'verbose_name_plural': 'Government plan followers',
|
||||
'ordering': ('-timestamp',),
|
||||
'get_latest_by': 'timestamp',
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='governmentplanfollower',
|
||||
constraint=models.UniqueConstraint(condition=models.Q(('user__isnull', False)), fields=('content_object', 'user'), name='unique_user_follower_froide_govplan_governmentplanfollower'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='governmentplanfollower',
|
||||
constraint=models.UniqueConstraint(condition=models.Q(('user__isnull', True)), fields=('content_object', 'email'), name='unique_email_follower_froide_govplan_governmentplanfollower'),
|
||||
),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue