from __future__ import unicode_literals
from django.db import models, migrations
-from django.core.management import call_command
import datetime
import patchwork.models
import django.db.models.deletion
from django.conf import settings
+
class Migration(migrations.Migration):
dependencies = [
--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('patchwork', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='patch',
+ name='state',
+ field=models.ForeignKey(to='patchwork.State', null=True),
+ ),
+ ]
date = models.DateTimeField(default=datetime.datetime.now)
submitter = models.ForeignKey(Person)
delegate = models.ForeignKey(User, blank = True, null = True)
- state = models.ForeignKey(State, default=get_default_initial_patch_state)
+ state = models.ForeignKey(State, null=True)
archived = models.BooleanField(default = False)
headers = models.TextField(blank = True)
content = models.TextField(null = True, blank = True)
self._set_tag(tag, counter[tag])
def save(self):
- try:
- s = self.state
- except:
- self.state = State.objects.get(ordering = 0)
+ if not hasattr(self, 'state') or not self.state:
+ self.state = get_default_initial_patch_state()
if self.hash is None and self.content is not None:
self.hash = hash_patch(self.content).hexdigest()