Commit 6ae2798c authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

Change projects, eliminate development migrations

Change Project's state field and ProjectMembershipHistory's person field;
replace all migrations starting 0015 with a single new one.

Need to check for missing data migrations.
parent 7304e6f0
...@@ -55,7 +55,7 @@ class Command(NoArgsCommand): ...@@ -55,7 +55,7 @@ class Command(NoArgsCommand):
labels = ( labels = (
'Application', 'Precursor', 'Status', 'Name', 'Project', 'Status' 'Application', 'Precursor', 'Status', 'Name', 'Project', 'Status'
) )
columns = (11, 10, 10, 30, 10, 10) columns = (11, 10, 14, 30, 10, 10)
if not options['csv']: if not options['csv']:
line = ' '.join(l.rjust(w) for l, w in zip(labels, columns)) line = ' '.join(l.rjust(w) for l, w in zip(labels, columns))
...@@ -85,7 +85,7 @@ class Command(NoArgsCommand): ...@@ -85,7 +85,7 @@ class Command(NoArgsCommand):
fields = ( fields = (
str(app.id), str(app.id),
str(prec_id), str(prec_id),
app.state, app.state_display(),
app.name, app.name,
str(project_id), str(project_id),
status status
......
...@@ -1166,13 +1166,6 @@ class ProjectApplicationManager(ForUpdateManager): ...@@ -1166,13 +1166,6 @@ class ProjectApplicationManager(ForUpdateManager):
return self.filter(q) return self.filter(q)
PROJECT_STATE_DISPLAY = {
'Pending': _('Pending review'),
'Approved': _('Active'),
'Replaced': _('Replaced'),
'Unknown': _('Unknown')
}
USER_STATUS_DISPLAY = { USER_STATUS_DISPLAY = {
100: _('Owner'), 100: _('Owner'),
0: _('Join requested'), 0: _('Join requested'),
...@@ -1194,14 +1187,17 @@ def new_chain(): ...@@ -1194,14 +1187,17 @@ def new_chain():
class ProjectApplication(models.Model): class ProjectApplication(models.Model):
PENDING, APPROVED, REPLACED, UNKNOWN = 'Pending', 'Approved', 'Replaced', 'Unknown'
applicant = models.ForeignKey( applicant = models.ForeignKey(
AstakosUser, AstakosUser,
related_name='projects_applied', related_name='projects_applied',
db_index=True) db_index=True)
state = models.CharField(max_length=80, PENDING = 0
default=PENDING) APPROVED = 1
REPLACED = 2
DENIED = 3
state = models.IntegerField(default=PENDING)
owner = models.ForeignKey( owner = models.ForeignKey(
AstakosUser, AstakosUser,
...@@ -1239,8 +1235,16 @@ class ProjectApplication(models.Model): ...@@ -1239,8 +1235,16 @@ class ProjectApplication(models.Model):
def __unicode__(self): def __unicode__(self):
return "%s applied by %s" % (self.name, self.applicant) return "%s applied by %s" % (self.name, self.applicant)
# TODO: Move to a more suitable place
PROJECT_STATE_DISPLAY = {
PENDING : _('Pending review'),
APPROVED: _('Active'),
REPLACED: _('Replaced'),
DENIED : _('Denied')
}
def state_display(self): def state_display(self):
return PROJECT_STATE_DISPLAY.get(self.state, _('Unknown')) return self.PROJECT_STATE_DISPLAY.get(self.state, _('Unknown'))
def add_resource_policy(self, service, resource, uplimit): def add_resource_policy(self, service, resource, uplimit):
"""Raises ObjectDoesNotExist, IntegrityError""" """Raises ObjectDoesNotExist, IntegrityError"""
...@@ -1633,7 +1637,7 @@ class ProjectMembership(models.Model): ...@@ -1633,7 +1637,7 @@ class ProjectMembership(models.Model):
history_item = ProjectMembershipHistory( history_item = ProjectMembershipHistory(
serial=self.id, serial=self.id,
person=self.person.uuid, person=self.person_id,
project=self.project_id, project=self.project_id,
date=date or datetime.now(), date=date or datetime.now(),
reason=reason) reason=reason)
...@@ -1945,7 +1949,7 @@ class ProjectMembershipHistory(models.Model): ...@@ -1945,7 +1949,7 @@ class ProjectMembershipHistory(models.Model):
reasons_list = ['ACCEPT', 'REJECT', 'REMOVE'] reasons_list = ['ACCEPT', 'REJECT', 'REMOVE']
reasons = dict((k, v) for v, k in enumerate(reasons_list)) reasons = dict((k, v) for v, k in enumerate(reasons_list))
person = models.CharField(max_length=255) person = models.BigIntegerField()
project = models.BigIntegerField() project = models.BigIntegerField()
date = models.DateField(default=datetime.now) date = models.DateField(default=datetime.now)
reason = models.IntegerField() reason = models.IntegerField()
......
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