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