Merge lp:~frigory/inkscape-web/projects into lp:inkscape-web

Proposed by Bryce Harrington
Status: Merged
Merged at revision: 1546
Proposed branch: lp:~frigory/inkscape-web/projects
Merge into: lp:inkscape-web
Diff against target: 154 lines (+80/-22)
3 files modified
projects/admin.py (+1/-1)
projects/migrations/0004_auto_20161211_0746.py (+58/-0)
projects/models.py (+21/-21)
To merge this branch: bzr merge lp:~frigory/inkscape-web/projects
Reviewer Review Type Date Requested Status
Martin Owens code Approve
Review via email: mp+312994@code.launchpad.net

Commit message

Migration for improving projects model design.

To post a comment you must log in.
Revision history for this message
Martin Owens (doctormo) wrote :

Looking good.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'projects/admin.py'
2--- projects/admin.py 2016-01-21 05:43:13 +0000
3+++ projects/admin.py 2016-12-12 05:31:01 +0000
4@@ -32,7 +32,7 @@
5 model = Deliverable
6
7 class UpdateInline(StackedInline):
8- model = ProjectUpdate
9+ model = Report
10 extra = 1
11 readonly_fields = ('creator',)
12
13
14=== added file 'projects/migrations/0004_auto_20161211_0746.py'
15--- projects/migrations/0004_auto_20161211_0746.py 1970-01-01 00:00:00 +0000
16+++ projects/migrations/0004_auto_20161211_0746.py 2016-12-12 05:31:01 +0000
17@@ -0,0 +1,58 @@
18+# -*- coding: utf-8 -*-
19+from __future__ import unicode_literals
20+
21+from django.db import migrations, models
22+import cms.utils.permissions
23+import pile.fields
24+from django.conf import settings
25+import django.core.validators
26+
27+
28+class Migration(migrations.Migration):
29+
30+ dependencies = [
31+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
32+ ('projects', '0003_auto_20160312_1649'),
33+ ]
34+
35+ operations = [
36+ migrations.RenameField(
37+ model_name='criteria',
38+ old_name='detail',
39+ new_name='description',
40+ ),
41+ migrations.RenameField(
42+ model_name='criteria',
43+ old_name='content',
44+ new_name='name',
45+ ),
46+ migrations.RenameField(
47+ model_name='project',
48+ old_name='desc',
49+ new_name='description',
50+ ),
51+ migrations.RenameField(
52+ model_name='project',
53+ old_name='sort',
54+ new_name='difficulty',
55+ ),
56+ migrations.RenameField(
57+ model_name='task',
58+ old_name='delive',
59+ new_name='deliverable',
60+ ),
61+ migrations.RenameModel(
62+ old_name='ProjectUpdate',
63+ new_name='Report',
64+ ),
65+ migrations.RenameField(
66+ model_name='report',
67+ old_name='describe',
68+ new_name='description',
69+ ),
70+ migrations.AlterField(
71+ model_name='relatedfile',
72+ name='for_update',
73+ field=models.ForeignKey(related_name='related_files', to='projects.Report'),
74+ ),
75+ ]
76
77=== modified file 'projects/models.py'
78--- projects/models.py 2016-10-06 01:32:16 +0000
79+++ projects/models.py 2016-12-12 05:31:01 +0000
80@@ -61,11 +61,11 @@
81 LOGO = os.path.join(settings.STATIC_URL, 'images', 'project_logo.png')
82 BANNER = os.path.join(settings.STATIC_URL, 'images', 'project_banner.png')
83
84- sort = IntegerField(_('Difficulty'), choices=DIFFICULTIES, default=2)
85- title = CharField(_('Title'), max_length=100)
86- pitch = CharField(_('Short Summary'), max_length=255, **null)
87- slug = SlugField(unique=True)
88- desc = TextField(_('Description'), validators=[MaxLengthValidator(50192)], **null)
89+ difficulty = IntegerField(_('Difficulty'), choices=DIFFICULTIES, default=2)
90+ title = CharField(_('Title'), max_length=100)
91+ pitch = CharField(_('Short Summary'), max_length=255, **null)
92+ slug = SlugField(unique=True)
93+ description = TextField(_('Description'), validators=[MaxLengthValidator(50192)], **null)
94
95 banner = ResizedImageField(_("Banner (920x120)"), max_height=120, max_width=920,
96 min_height=90, min_width=600,
97@@ -182,8 +182,8 @@
98
99 class Task(Model):
100 """A task or sub-task of a deliverable stage"""
101- delive = ForeignKey(Deliverable, related_name='tasks')
102- name = CharField(_('Task'), max_length=255)
103+ deliverable = ForeignKey(Deliverable, related_name='tasks')
104+ name = CharField(_('Task'), max_length=255)
105
106 targeted = DateField(**null)
107 finished = DateField(**null)
108@@ -196,32 +196,32 @@
109
110
111 class Criteria(Model):
112- content = CharField(_('Criteria'), max_length=255)
113- detail = TextField(validators=[MaxLengthValidator(4096)], **null)
114+ name = CharField(_('Criteria'), max_length=255)
115+ description = TextField(validators=[MaxLengthValidator(4096)], **null)
116
117 def __str__(self):
118- return self.content
119-
120-
121-class ProjectUpdate(Model):
122+ return self.name
123+
124+
125+class Report(Model):
126 """A project should always have at least one update with its primary description"""
127
128- project = ForeignKey(Project, related_name='updates')
129- describe = TextField(_("Description"), validators=[MaxLengthValidator(12288)])
130- image = ResizedImageField(_("Image"), max_height=400, max_width=400,
131+ project = ForeignKey(Project, related_name='updates')
132+ description = TextField(_("Description"), validators=[MaxLengthValidator(12288)])
133+ image = ResizedImageField(_("Image"), max_height=400, max_width=400,
134 upload_to=os.path.join('project', 'update', '%Y'), **null)
135
136- creator = ForeignKey(settings.AUTH_USER_MODEL, default=get_user)
137- created = DateTimeField(auto_now_add=True, db_index=True)
138- edited = DateTimeField(auto_now=True)
139+ creator = ForeignKey(settings.AUTH_USER_MODEL, default=get_user)
140+ created = DateTimeField(auto_now_add=True, db_index=True)
141+ edited = DateTimeField(auto_now=True)
142
143 def __str__(self):
144- return self.describe
145+ return self.description
146
147 class RelatedFile(Model):
148 """Allows to add files to Project Update reports"""
149
150- for_update = ForeignKey(ProjectUpdate, related_name='related_files')
151+ for_update = ForeignKey(Report, related_name='related_files')
152 updatefile = FileField(_("Related File"), upload_to=os.path.join('project', 'related_files'))
153
154 def __str__(self):

Subscribers

People subscribed via source and target branches

to status/vote changes: