INITIAL
This commit is contained in:
commit
7ba937ef66
66 changed files with 1823 additions and 0 deletions
1
ccdb/contrib/sites/__init__.py
Normal file
1
ccdb/contrib/sites/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
# -*- coding: utf-8 -*-
|
31
ccdb/contrib/sites/migrations/0001_initial.py
Normal file
31
ccdb/contrib/sites/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
import django.contrib.sites.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Site',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
|
||||
('domain', models.CharField(verbose_name='domain name', max_length=100, validators=[django.contrib.sites.models._simple_domain_name_validator])),
|
||||
('name', models.CharField(verbose_name='display name', max_length=50)),
|
||||
],
|
||||
options={
|
||||
'verbose_name_plural': 'sites',
|
||||
'verbose_name': 'site',
|
||||
'db_table': 'django_site',
|
||||
'ordering': ('domain',),
|
||||
},
|
||||
managers=[
|
||||
(b'objects', django.contrib.sites.models.SiteManager()),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -0,0 +1,40 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def update_site_forward(apps, schema_editor):
|
||||
"""Set site domain and name."""
|
||||
Site = apps.get_model("sites", "Site")
|
||||
Site.objects.update_or_create(
|
||||
id=settings.SITE_ID,
|
||||
defaults={
|
||||
"domain": "ccdb.info",
|
||||
"name": "ccdb"
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def update_site_backward(apps, schema_editor):
|
||||
"""Revert site domain and name to default."""
|
||||
Site = apps.get_model("sites", "Site")
|
||||
Site.objects.update_or_create(
|
||||
id=settings.SITE_ID,
|
||||
defaults={
|
||||
"domain": "example.com",
|
||||
"name": "example.com"
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('sites', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(update_site_forward, update_site_backward),
|
||||
]
|
21
ccdb/contrib/sites/migrations/0003_auto_20151221_2141.py
Normal file
21
ccdb/contrib/sites/migrations/0003_auto_20151221_2141.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.contrib.sites.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('sites', '0002_set_site_domain_and_name'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelManagers(
|
||||
name='site',
|
||||
managers=[
|
||||
('objects', django.contrib.sites.models.SiteManager()),
|
||||
],
|
||||
),
|
||||
]
|
1
ccdb/contrib/sites/migrations/__init__.py
Normal file
1
ccdb/contrib/sites/migrations/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
# -*- coding: utf-8 -*-
|
Loading…
Add table
Add a link
Reference in a new issue