| author | cavaliet |
| Mon, 26 Aug 2013 13:06:12 +0200 | |
| changeset 153 | 0b710028f3d3 |
| parent 93 | 49787b7a47d8 |
| child 159 | 2c995c53bd88 |
| permissions | -rw-r--r-- |
| 93 | 1 |
from django.contrib.auth.models import Group |
|
78
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
2 |
from django.db import models |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
3 |
from django.db.models import Model |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
4 |
from ldt.ldt_utils.models import Project |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
5 |
|
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
6 |
|
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
7 |
class Branding(Model): |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
8 |
|
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
9 |
name = models.CharField(max_length=255, unique=True, blank=True, null=True) |
| 93 | 10 |
group = models.ForeignKey(Group, null=True) |
|
78
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
11 |
|
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
12 |
def __unicode__(self): |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
13 |
return unicode(self.id) + u"::" + unicode(self.name) |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
14 |
|
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
15 |
|
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
16 |
class Mashup(Model): |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
17 |
|
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
18 |
project = models.ForeignKey(Project, null=True) |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
19 |
branding = models.ForeignKey(Branding) |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
20 |
|
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
21 |
def __unicode__(self): |
| 83 | 22 |
return unicode(self.id) + u"::" + unicode(self.branding.name) + u"::" + unicode(self.project.owner) + u"::" + unicode(self.project.ldt_id) |
|
78
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
23 |
|
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
24 |
def creator(): #@NoSelf |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
25 |
def fget(self): |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
26 |
if self.project is not None: |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
27 |
return self.project.owner |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
28 |
else: |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
29 |
return None |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
30 |
return locals() |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
31 |
|
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
32 |
creator = property(**creator()) |
|
ac3e789bced2
Model for branding and mashup, 1st datamigration for iri and bpi branding. Post url to save mashup project.
cavaliet
parents:
diff
changeset
|
33 |