Commit 3466f67a authored by Florent Chehab's avatar Florent Chehab

Removed modules related to photo

parent 1ba5a674
Pipeline #26801 passed with stages
in 2 minutes and 6 seconds
......@@ -62,12 +62,6 @@
import_location: otherCore
api_end_point: other/offer
- model: CountryPhoto
viewset: CountryPhotoViewSet
import_location: location
api_end_point: country_more/photos
versionned: true
- model: CountryScholarship
viewset: CountryScholarshipViewSet
import_location: location
......@@ -80,13 +74,6 @@
api_end_point: country_more/dri
versionned: true
- model: CityPhoto
viewset: CityPhotoViewSet
import_location: location
api_end_point: city_more/photos
versionned: true
- model: University
viewset: UniversityViewSet
import_location: university
......@@ -122,12 +109,6 @@
api_end_point: university_more/semesters_dates
versionned: true
- model: UniversityPhoto
viewset: UniversityPhotoViewSet
import_location: university
api_end_point: university_more/photo
versionned: true
- model: UniversityDri
viewset: UniversityDriViewSet
import_location: university
......
from .country import Country, CountrySerializer, CountryViewSet # noqa: F401
from .countryPhoto import CountryPhoto, CountryPhotoViewSet # noqa: F401
from .countryScholarship import CountryScholarship, CountryScholarshipViewSet # noqa: F401
from .countryDri import CountryDri, CountryDriViewSet # noqa: F401
from .countryTaggedItem import CountryTaggedItem, CountryTaggedItemSerializer, CountryTaggedItemViewSet # noqa: F401
from .city import City, CitySerializer, CityViewSet # noqa: F401
from .cityPhoto import CityPhoto, CityPhotoViewSet # noqa: F401
from .cityTaggedItem import CityTaggedItem, CityTaggedItemSerializer, CityTaggedItemViewSet # noqa: F401
from django.db import models
from backend.models.location import City
from backend.models.module import Photo, PhotoSerializer, PhotoViewSet
class CityPhoto(Photo):
city = models.OneToOneField(
City,
on_delete=models.CASCADE,
related_name='city_photos')
@classmethod
def get_serializer(cls):
return CityPhotoSerializer
class Meta:
unique_together = ('city', 'photo')
class CityPhotoSerializer(PhotoSerializer):
class Meta:
model = CityPhoto
fields = '__all__'
class CityPhotoViewSet(PhotoViewSet):
queryset = CityPhoto.objects.all() # pylint: disable=E1101
serializer_class = CityPhotoSerializer
from django.db import models
from backend.models.location import Country
from backend.models.module import Photo, PhotoSerializer, PhotoViewSet
class CountryPhoto(Photo):
country = models.ForeignKey(
Country,
on_delete=models.CASCADE,
related_name='country_photos')
@classmethod
def get_serializer(cls):
return CountryPhotoSerializer
class Meta:
unique_together = ('country', 'photo')
class CountryPhotoSerializer(PhotoSerializer):
class Meta:
model = CountryPhoto
fields = '__all__'
class CountryPhotoViewSet(PhotoViewSet):
queryset = CountryPhoto.objects.all() # pylint: disable=E1101
serializer_class = CountryPhotoSerializer
from .basicModule import BasicModule, BasicModuleSerializer, BasicModuleViewSet # noqa: F401
from .scholarship import Scholarship, ScholarshipSerializer, ScholarshipViewSet # noqa: F401
from .photo import Photo, PhotoSerializer, PhotoViewSet # noqa: F401
from .driRestrictedModule import DriRestrictedModule, DriRestrictedModuleSerializer, DriRestrictedModuleViewSet # noqa: F401
from .currency import Currency, CurrencyViewSet, CurrencySerializer # noqa: F401
from django.db import models
from backend.models.my_model import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
from backend.utils.friendly_path import friendly_path
path_and_rename = friendly_path("uploads/universities/photos/", 'title')
class Photo(MyModelVersionned):
photo = models.ImageField(upload_to=path_and_rename, max_length=250,
default='path/to/my/default/image.jpg') # TODO CHANGE !
title = models.CharField(max_length=200)
description = models.TextField(null=True, blank=True)
class Meta:
abstract = True
class PhotoSerializer(MyModelVersionnedSerializer):
class Meta:
model = Photo
fields = '__all__'
class PhotoViewSet(MyModelVersionnedViewSet):
serializer_class = PhotoSerializer
......@@ -5,7 +5,6 @@ from .universityScholarship import UniversityScholarship, UniversityScholarshipS
from .universityDri import UniversityDri, UniversityDriSerializer, UniversityDriViewSet # noqa: F401
from .universityInfo import UniversityInfo, UniversityInfoSerializer, UniversityInfoViewSet # noqa: F401
from .universitySemestersDates import UniversitySemestersDates, UniversitySemestersDatesSerializer, UniversitySemestersDatesViewSet # noqa: F401
from .universityPhoto import UniversityPhoto, UniversityPhotoSerializer, UniversityPhotoViewSet # noqa: F401
from .universityModulesAPI import UniversityModulesViewSet # noqa: F401
from .universityTaggedItem import UniversityTaggedItem, UniversityTaggedItemSerializer, UniversityTaggedItemViewSet # noqa: F401
......
from django.db import models
from backend.models.university import University
from backend.models.module import Photo, PhotoSerializer, PhotoViewSet
class UniversityPhoto(Photo):
university = models.ForeignKey(
University,
on_delete=models.CASCADE,
related_name='university_photos')
@classmethod
def get_serializer(cls):
return UniversityPhotoSerializer
class Meta:
unique_together = ('university', 'photo')
class UniversityPhotoSerializer(PhotoSerializer):
class Meta:
model = UniversityPhoto
fields = '__all__'
class UniversityPhotoViewSet(PhotoViewSet):
queryset = UniversityPhoto.objects.all() # pylint: disable=E1101
serializer_class = UniversityPhotoSerializer
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