Commit 063123f8 authored by Okhin's avatar Okhin

Adding migrations

parent ac3ed384
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bt', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='violation',
name='old',
field=models.BooleanField(default=b'False'),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def archive_old(apps, schema_editor):
Violation = apps.get_model("bt", "Violation")
for violation in Violation.objects.all():
person.old = True
person.save()
class Migration(migrations.Migration):
dependencies = [
('bt', '0002_violation_old'),
]
operations = [
migrations.RunPython(archive_old),
]
...@@ -89,6 +89,7 @@ class Violation(models.Model): ...@@ -89,6 +89,7 @@ class Violation(models.Model):
activationid= models.CharField(max_length=128, blank=True) activationid= models.CharField(max_length=128, blank=True)
state = models.CharField(max_length=20, choices=STATUS, default='new', blank=True) state = models.CharField(max_length=20, choices=STATUS, default='new', blank=True)
editorial = models.TextField(blank=True) editorial = models.TextField(blank=True)
old = models.BooleanField(default="False", blank=False)
def confirmations(self): def confirmations(self):
return self.confirmation_set.filter(key='').count() return self.confirmation_set.filter(key='').count()
...@@ -108,7 +109,6 @@ class Violation(models.Model): ...@@ -108,7 +109,6 @@ class Violation(models.Model):
def __unicode__(self): def __unicode__(self):
return "#%s %s/%s" % (self.pk, self.country, self.operator) return "#%s %s/%s" % (self.pk, self.country, self.operator)
class Comment(models.Model): class Comment(models.Model):
submitter_email = models.EmailField() submitter_email = models.EmailField()
submitter_name = models.CharField(max_length=20) submitter_name = models.CharField(max_length=20)
......
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