11# -*- coding: utf-8 -*-
22from __future__ import unicode_literals
33
4+ import django
45from django .db import models , migrations
56import django .utils .timezone
67
@@ -11,23 +12,60 @@ class Migration(migrations.Migration):
1112 ('sites' , '0001_initial' ),
1213 ]
1314
14- operations = [
15- migrations .CreateModel (
16- name = 'Template' ,
17- fields = [
18- ('id' , models .AutoField (verbose_name = 'ID' , serialize = False , auto_created = True , primary_key = True )),
19- ('name' , models .CharField (help_text = "Example: 'flatpages/default.html'" , max_length = 100 , verbose_name = 'name' )),
20- ('content' , models .TextField (verbose_name = 'content' , blank = True )),
21- ('creation_date' , models .DateTimeField (default = django .utils .timezone .now , verbose_name = 'creation date' )),
22- ('last_changed' , models .DateTimeField (default = django .utils .timezone .now , verbose_name = 'last changed' )),
23- ('sites' , models .ManyToManyField (to = 'sites.Site' , verbose_name = 'sites' , blank = True )),
24- ],
25- options = {
26- 'ordering' : ('name' ,),
27- 'db_table' : 'django_template' ,
28- 'verbose_name' : 'template' ,
29- 'verbose_name_plural' : 'templates' ,
30- },
31- bases = (models .Model ,),
32- ),
33- ]
15+ if django .get_version () >= '1.8' :
16+ operations = [
17+ migrations .CreateModel (
18+ name = 'Template' ,
19+ fields = [
20+ ('id' , models .AutoField (
21+ verbose_name = 'ID' , serialize = False , auto_created = True , primary_key = True )),
22+ ('name' , models .CharField (
23+ help_text = "Example: 'flatpages/default.html'" , max_length = 100 , verbose_name = 'name' )),
24+ ('content' , models .TextField (verbose_name = 'content' , blank = True )),
25+ ('creation_date' , models .DateTimeField (
26+ default = django .utils .timezone .now , verbose_name = 'creation date' )),
27+ ('last_changed' , models .DateTimeField (
28+ default = django .utils .timezone .now , verbose_name = 'last changed' )),
29+ ('sites' , models .ManyToManyField (
30+ to = 'sites.Site' , verbose_name = 'sites' , blank = True )),
31+ ],
32+ options = {
33+ 'ordering' : ('name' ,),
34+ 'db_table' : 'django_template' ,
35+ 'verbose_name' : 'template' ,
36+ 'verbose_name_plural' : 'templates' ,
37+ },
38+ bases = (models .Model ,),
39+ managers = [
40+ ('objects' , django .db .models .manager .Manager ()),
41+ ('on_site' , django .contrib .sites .managers .CurrentSiteManager (
42+ b'sites' )),
43+ ],
44+ ),
45+ ]
46+ else :
47+ operations = [
48+ migrations .CreateModel (
49+ name = 'Template' ,
50+ fields = [
51+ ('id' , models .AutoField (
52+ verbose_name = 'ID' , serialize = False , auto_created = True , primary_key = True )),
53+ ('name' , models .CharField (
54+ help_text = "Example: 'flatpages/default.html'" , max_length = 100 , verbose_name = 'name' )),
55+ ('content' , models .TextField (verbose_name = 'content' , blank = True )),
56+ ('creation_date' , models .DateTimeField (
57+ default = django .utils .timezone .now , verbose_name = 'creation date' )),
58+ ('last_changed' , models .DateTimeField (
59+ default = django .utils .timezone .now , verbose_name = 'last changed' )),
60+ ('sites' , models .ManyToManyField (
61+ to = 'sites.Site' , verbose_name = 'sites' , blank = True )),
62+ ],
63+ options = {
64+ 'ordering' : ('name' ,),
65+ 'db_table' : 'django_template' ,
66+ 'verbose_name' : 'template' ,
67+ 'verbose_name_plural' : 'templates' ,
68+ },
69+ bases = (models .Model ,),
70+ ),
71+ ]
0 commit comments