Commit dd23c42e authored by chirac's avatar chirac
Browse files

Merge branch 'squash-migrations' into 'dev'

Squash migrations

See merge request !578
parents bea0a787 d4dd5d89
Pipeline #3152 failed with stage
in 26 seconds
......@@ -31,31 +31,6 @@ from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext as _
def _create_api_permission():
"""Creates the 'use_api' permission if not created.
The 'use_api' is a fake permission in the sense it is not associated with an
existing model and this ensure the permission is created every time this file
is imported.
"""
api_content_type, created = ContentType.objects.get_or_create(
app_label=settings.API_CONTENT_TYPE_APP_LABEL,
model=settings.API_CONTENT_TYPE_MODEL,
)
if created:
api_content_type.save()
api_permission, created = Permission.objects.get_or_create(
name=settings.API_PERMISSION_NAME,
content_type=api_content_type,
codename=settings.API_PERMISSION_CODENAME,
)
if created:
api_permission.save()
_create_api_permission()
def can_view(user, *args, **kwargs):
"""Check if an user can view the application.
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.conf import settings
def create_api_permission(apps, schema_editor):
"""Creates the 'use_api' permission if not created.
The 'use_api' is a fake permission in the sense it is not associated with an
existing model and this ensure the permission is created.
"""
ContentType = apps.get_model("contenttypes", "ContentType")
Permission = apps.get_model("auth", "Permission")
api_content_type, created = ContentType.objects.get_or_create(
app_label=settings.API_CONTENT_TYPE_APP_LABEL,
model=settings.API_CONTENT_TYPE_MODEL,
)
if created:
api_content_type.save()
api_permission, created = Permission.objects.get_or_create(
name=settings.API_PERMISSION_NAME,
content_type=api_content_type,
codename=settings.API_PERMISSION_CODENAME,
)
if created:
api_permission.save()
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.RunPython(create_api_permission)
]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -11,7 +11,6 @@ class Migration(migrations.Migration):
dependencies = [
("machines", "0062_extension_origin_v6"),
("reversion", "0001_squashed_0004_auto_20160611_1202"),
]
operations = [
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-12-30 17:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
replaces = [('multi_op', '0001_initial'), ('multi_op', '0002_auto_20200904_1905'), ('multi_op', '0003_auto_20200904_1938')]
initial = True
dependencies = [
('topologie', '0002_foreign_keys'),
]
operations = [
migrations.CreateModel(
name='MultiopOption',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('enabled_dorm', models.ManyToManyField(blank=True, related_name='enabled_dorm_multiop', to='topologie.Dormitory', verbose_name='enabled dorm')),
],
options={
'verbose_name': 'dormitories preferences',
},
),
]
This diff is collapsed.
This diff is collapsed.
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-12-30 16:53
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import re2o.mixins
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
replaces = [
("tickets", "0001_initial"),
("tickets", "0002_auto_20191120_0159"),
("tickets", "0003_auto_20200422_1839"),
("tickets", "0004_auto_20200422_2127"),
("tickets", "0005_auto_20200422_2309"),
("tickets", "0006_auto_20200423_0202"),
("tickets", "0007_ticket_language"),
]
operations = [
migrations.CreateModel(
name='CommentTicket',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateTimeField(auto_now_add=True)),
('comment', models.TextField(max_length=4095)),
('created_at', models.DateTimeField(auto_now_add=True)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ticket_comment', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'ticket',
'verbose_name_plural': 'tickets',
'permissions': (('view_commentticket', 'Can view a ticket object'),),
},
bases=(re2o.mixins.AclMixin, models.Model),
),
migrations.CreateModel(
name='Ticket',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(help_text='Title of the ticket.', max_length=255)),
('description', models.TextField(max_length=3000)),
('date', models.DateTimeField(auto_now_add=True)),
('email', models.EmailField(help_text='An email address to get back to you.', max_length=100, null=True)),
('solved', models.BooleanField(default=False)),
('language', models.CharField(default='en', help_text='Language of the ticket.', max_length=16)),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tickets', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'ticket',
'verbose_name_plural': 'tickets',
'permissions': (('view_ticket', 'Can view a ticket object'),),
},
bases=(re2o.mixins.AclMixin, models.Model),
),
migrations.CreateModel(
name='TicketOption',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('publish_address', models.EmailField(help_text='Email address to publish the new tickets (leave empty for no publication).', max_length=1000, null=True)),
],
options={
'verbose_name': 'tickets options',
'permissions': (('view_ticketoption', 'Can view tickets options'),),
},
bases=(re2o.mixins.AclMixin, models.Model),
),
migrations.AddField(
model_name='commentticket',
name='parent_ticket',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tickets.Ticket'),
),
]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment