Example #1
0
class ItemSerializer(serializers.ModelSerializer):
    image = ResponsiveImageSerializer()
    category = CategorySerializer()

    class Meta:
        model = Item
        fields = ("pk", "name", "price", "description", "image", "category")
Example #2
0
class ProductReadOnlySerializer(serializers.ModelSerializer):
    category = CategoryReadOnlySerializer()
    product_sizes = ProductSizeReadOnlySerializer(many=True)
    images = ResponsiveImageSerializer(many=True)
    related_products = serializers.PrimaryKeyRelatedField(
        many=True,
        queryset=Product.objects.filter(active=True),
    )

    class Meta:
        model = Product
        fields = (
            'id',
            'category',
            'name',
            'slug',
            'short',
            'description',
            'images',
            'price',
            'stock',
            'deadline',
            'active',
            'product_sizes',
            'related_products',
        )
        read_only = True
Example #3
0
class EventSerializer(serializers.ModelSerializer):
    absolute_url = serializers.CharField(source='get_absolute_url',
                                         read_only=True)
    attendance_event = AttendanceEventSerializer()
    company_event = CompanyEventSerializer(many=True)
    image = ResponsiveImageSerializer()

    class Meta:
        model = Event
        fields = (
            'absolute_url',
            'attendance_event',
            'company_event',
            'description',
            'event_start',
            'event_end',
            'event_type',
            'id',
            'image',
            'ingress',
            'ingress_short',
            'location',
            'slug',
            'title',
        )
Example #4
0
class OfflineIssueSerializer(serializers.ModelSerializer):
    image = ResponsiveImageSerializer()

    class Meta:
        model = Issue
        fields = ("description", "id", "issue", "release_date", "title",
                  "image")
Example #5
0
class ItemSerializer(serializers.ModelSerializer):
    image = ResponsiveImageSerializer()
    category = CategorySerializer()

    class Meta:
        model = Item
        fields = ('pk', 'name', 'price', 'description', 'image', 'category')
Example #6
0
class ArticleSerializer(TaggitSerializer, serializers.ModelSerializer):
    created_by = UserReadOnlySerializer()
    image = ResponsiveImageSerializer()
    tags = TagListSerializerField()
    absolute_url = serializers.CharField(source="get_absolute_url",
                                         read_only=True)

    class Meta:
        model = Article
        fields = (
            "absolute_url",
            "authors",
            "created_by",
            "changed_date",
            "content",
            "created_date",
            "featured",
            "heading",
            "id",
            "ingress",
            "ingress_short",
            "published_date",
            "slug",
            "tags",
            "video",
            "image",
        )
Example #7
0
class ProductReadOnlySerializer(serializers.ModelSerializer):
    category = CategoryReadOnlySerializer()
    product_sizes = ProductSizeReadOnlySerializer(many=True)
    images = ResponsiveImageSerializer(many=True)
    related_products = serializers.PrimaryKeyRelatedField(
        many=True, queryset=Product.objects.filter(active=True))

    class Meta:
        model = Product
        fields = (
            "id",
            "category",
            "name",
            "slug",
            "short",
            "description",
            "images",
            "price",
            "stock",
            "deadline",
            "active",
            "product_sizes",
            "related_products",
        )
        read_only = True
Example #8
0
class EventSerializer(serializers.ModelSerializer):
    absolute_url = serializers.CharField(source="get_absolute_url",
                                         read_only=True)
    attendance_event = AttendanceEventSerializer()
    company_event = CompanyEventSerializer(many=True)
    image = ResponsiveImageSerializer()

    class Meta:
        model = Event
        fields = (
            "absolute_url",
            "attendance_event",
            "company_event",
            "description",
            "event_start",
            "event_end",
            "event_type",
            "id",
            "image",
            "ingress",
            "ingress_short",
            "location",
            "slug",
            "title",
            "organizer_name",
            "organizer",
        )
Example #9
0
class ResourceSerializer(serializers.ModelSerializer):

    image = ResponsiveImageSerializer(read_only=True)
    image_id = serializers.PrimaryKeyRelatedField(
        write_only=True,
        source='image',
        queryset=ResponsiveImage.objects.all())

    class Meta:
        model = Resource
        fields = ('id', 'title', 'description', 'image', 'image_id',
                  'priority', 'active')
Example #10
0
class ArticleSerializer(TaggitSerializer, serializers.ModelSerializer):
    created_by = UserReadOnlySerializer()
    image = ResponsiveImageSerializer()
    tags = TagListSerializerField()
    absolute_url = serializers.CharField(source='get_absolute_url',
                                         read_only=True)

    class Meta:
        model = Article
        fields = ('absolute_url', 'authors', 'created_by', 'changed_date',
                  'content', 'created_date', 'featured', 'heading', 'id',
                  'ingress', 'ingress_short', 'published_date', 'slug', 'tags',
                  'video', 'image')
Example #11
0
class CompanySerializer(serializers.ModelSerializer):
    image = ResponsiveImageSerializer()

    class Meta:
        model = Company

        fields = (
            'id',
            'name',
            'site',
            'image',
            'long_description',
            'short_description',
        )
Example #12
0
class CompanySerializer(serializers.ModelSerializer):
    image = ResponsiveImageSerializer()

    class Meta:
        model = Company

        fields = (
            "id",
            "name",
            "site",
            "image",
            "long_description",
            "short_description",
            "phone_number",
        )
Example #13
0
class ResourceSerializer(serializers.ModelSerializer):

    image = ResponsiveImageSerializer(read_only=True)
    image_id = serializers.PrimaryKeyRelatedField(
        write_only=True,
        source="image",
        queryset=ResponsiveImage.objects.all())

    class Meta:
        model = Resource
        fields = (
            "id",
            "title",
            "description",
            "image",
            "image_id",
            "priority",
            "active",
        )
Example #14
0
class OnlineGroupReadOnlySerializer(serializers.ModelSerializer):
    image = ResponsiveImageSerializer()

    class Meta:
        model = OnlineGroup
        fields = (
            'image',
            'name_short',
            'name_long',
            'name_short',
            'description_long',
            'description_short',
            'email',
            'created',
            'group_type',
            'verbose_type',
            'group',
            'members',
        )
        read_only = True
Example #15
0
class OnlineGroupReadOnlySerializer(serializers.ModelSerializer):
    image = ResponsiveImageSerializer()

    class Meta:
        model = OnlineGroup
        fields = (
            "image",
            "name_short",
            "name_long",
            "name_short",
            "description_long",
            "description_short",
            "email",
            "created",
            "group_type",
            "verbose_type",
            "group",
            "members",
        )
        read_only = True
Example #16
0
class PhotoReadOnlySerializer(serializers.ModelSerializer):
    photographer = UserNameSerializer()
    tags = TagListSerializerField()
    image = ResponsiveImageSerializer()

    class Meta:
        model = Photo
        fields = (
            "id",
            "album",
            "relative_id",
            "image",
            "created_date",
            "title",
            "description",
            "tags",
            "photographer_name",
            "photographer",
            "user_tags",
        )
        read_only = True
Example #17
0
class EventSerializer(serializers.ModelSerializer):
    images = ResponsiveImageSerializer(many=True)
    author = UserReadOnlySerializer()
    event_type_display = serializers.CharField(source="get_event_type_display",
                                               read_only=True)
    start_date = serializers.DateTimeField(source="event_start")
    end_date = serializers.DateTimeField(source="event_end")
    is_attendance_event = serializers.BooleanField(read_only=True)
    max_capacity = serializers.IntegerField(
        source="attendance_event.max_capacity")
    number_of_seats_taken = serializers.IntegerField(
        source="attendance_event.number_of_seats_taken")
    companies = serializers.StringRelatedField(many=True)

    class Meta:
        model = Event
        fields = (
            "id",
            "title",
            "slug",
            "ingress",
            "ingress_short",
            "description",
            "start_date",
            "end_date",
            "location",
            "event_type",
            "event_type_display",
            "organizer",
            "author",
            "images",
            "companies",
            "is_attendance_event",
            "max_capacity",
            "number_of_seats_taken",
        )
Example #18
0
class CompanySerializer(serializers.ModelSerializer):
    image = ResponsiveImageSerializer()

    class Meta(object):
        model = Company
        fields = ('name', 'site', 'image')