Skip to content

Commit

Permalink
add SimpleImage, update Action
Browse files Browse the repository at this point in the history
  • Loading branch information
yomguy committed Aug 29, 2023
1 parent 29120ef commit 52a9919
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
26 changes: 17 additions & 9 deletions organization/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class Meta:
abstract = True


class Image(Titled, Description, Orderable):
class SimpleImage(models.Model):

file = FileField(
_("Image"),
Expand All @@ -279,26 +279,21 @@ class Image(Titled, Description, Orderable):
blank=True,
)

title = models.CharField(
_('title'),
max_length=1024,
blank=True,
null=True
)

credits = models.CharField(
_('credits'),
max_length=256,
blank=True,
null=True
)

type = models.CharField(
_('type'),
max_length=64,
choices=IMAGE_TYPE_CHOICES,
blank=True,
null=True
)

crop_data = models.CharField(
max_length=1024,
null=True,
Expand All @@ -309,6 +304,19 @@ class Image(Titled, Description, Orderable):
class Meta:
abstract = True


class Image(Titled, Description, Orderable, SimpleImage):

title = models.CharField(
_('title'),
max_length=1024,
blank=True,
null=True
)

class Meta:
abstract = True

def __str__(self):
value = self.description
if not value:
Expand Down Expand Up @@ -683,7 +691,7 @@ class Meta:
abstract = True


class Action(Named):
class Action(Named, URL, SimpleImage):
"""
Abstract model that provides an Action object.
"""
Expand Down
4 changes: 2 additions & 2 deletions organization/pages/serializers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from django.contrib.contenttypes.models import ContentType
from ircamforum.api.core import ImageThumbnailSerializerMixin
from .models import CustomPage, PageAction
from rest_framework import serializers, viewsets


class PageActionSerializer(serializers.ModelSerializer):
class PageActionSerializer(serializers.ModelSerializer, ImageThumbnailSerializerMixin):

class Meta:
model = PageAction
Expand All @@ -18,4 +19,3 @@ class Meta:
model = CustomPage
fields = ("__all__")


0 comments on commit 52a9919

Please sign in to comment.