163 super(ContentManager, self).__init__(check_perm=False) |
163 super(ContentManager, self).__init__(check_perm=False) |
164 |
164 |
165 def get_by_natural_key(self, iri_id): |
165 def get_by_natural_key(self, iri_id): |
166 return self.get(iri_id=iri_id) |
166 return self.get(iri_id=iri_id) |
167 |
167 |
|
168 def get_content_image_default(): |
|
169 return settings.DEFAULT_CONTENT_ICON |
|
170 |
168 class Content(SafeModel): |
171 class Content(SafeModel): |
169 objects = ContentManager() |
172 objects = ContentManager() |
170 |
173 |
171 iri_id = models.CharField(max_length=255, unique=True, default=generate_uuid, verbose_name=_('content.iri_id')) |
174 iri_id = models.CharField(max_length=255, unique=True, default=generate_uuid, verbose_name=_('content.iri_id')) |
172 iriurl = models.CharField(max_length=1024, verbose_name=_('content.iriurl')) |
175 iriurl = models.CharField(max_length=1024, verbose_name=_('content.iriurl')) |
177 authors = models.ManyToManyField("Author", blank=True, verbose_name=_('content.authors')) |
180 authors = models.ManyToManyField("Author", blank=True, verbose_name=_('content.authors')) |
178 duration = models.IntegerField(null=True, blank=True, verbose_name=_('content.duration')) |
181 duration = models.IntegerField(null=True, blank=True, verbose_name=_('content.duration')) |
179 content_creation_date = models.DateTimeField(null=True, blank=True, verbose_name=_('content.content_creation_date')) |
182 content_creation_date = models.DateTimeField(null=True, blank=True, verbose_name=_('content.content_creation_date')) |
180 tags = TaggableManager() |
183 tags = TaggableManager() |
181 media_obj = models.ForeignKey("Media", blank=True, null=True) |
184 media_obj = models.ForeignKey("Media", blank=True, null=True) |
182 image = ImageField(upload_to="thumbnails/contents/", default=settings.DEFAULT_CONTENT_ICON, max_length=200) |
185 image = ImageField(upload_to="thumbnails/contents/", default=get_content_image_default, max_length=200) |
183 front_project = models.ForeignKey("Project", null=True, blank=True) |
186 front_project = models.ForeignKey("Project", null=True, blank=True) |
184 |
187 |
185 class Meta: |
188 class Meta: |
186 app_label="ldt_utils" |
189 app_label="ldt_utils" |
187 ordering = ["title"] |
190 ordering = ["title"] |
614 modification_date = models.DateTimeField(auto_now=True) |
620 modification_date = models.DateTimeField(auto_now=True) |
615 created_by = models.CharField(_("created by"), max_length=70) |
621 created_by = models.CharField(_("created by"), max_length=70) |
616 changed_by = models.CharField(_("changed by"), max_length=70) |
622 changed_by = models.CharField(_("changed by"), max_length=70) |
617 state = models.IntegerField(choices=STATE_CHOICES, default=1) |
623 state = models.IntegerField(choices=STATE_CHOICES, default=1) |
618 description = models.TextField(null=True, blank=True) |
624 description = models.TextField(null=True, blank=True) |
619 image = ImageField(upload_to="thumbnails/projects/", default=settings.DEFAULT_PROJECT_ICON, max_length=200) |
625 image = ImageField(upload_to="thumbnails/projects/", default=get_project_image_default, max_length=200) |
620 |
626 |
621 class Meta: |
627 class Meta: |
622 app_label="ldt_utils" |
628 app_label="ldt_utils" |
623 ordering = ["title"] |
629 ordering = ["title"] |
624 permissions = ( |
630 permissions = ( |