|
|
|
@ -472,7 +472,23 @@ class AdminBookTypeSerializer(serializers.ModelSerializer): |
|
|
|
class AdminBookAuthorSerializer(serializers.ModelSerializer): |
|
|
|
class Meta: |
|
|
|
model = BookAuthor |
|
|
|
fields = ["id", "name", "birth_year_hijri", "death_year_hijri", "birth_year_miladi", "death_year_miladi"] |
|
|
|
fields = [ |
|
|
|
"id", |
|
|
|
"name", |
|
|
|
"slug", |
|
|
|
"birth_year_hijri", |
|
|
|
"death_year_hijri", |
|
|
|
"birth_year_miladi", |
|
|
|
"death_year_miladi", |
|
|
|
"related_narrator", |
|
|
|
"known_as", |
|
|
|
"scholarity", |
|
|
|
"tabaqa", |
|
|
|
"rutba", |
|
|
|
"features", |
|
|
|
"book_references", |
|
|
|
] |
|
|
|
read_only_fields = ["id", "slug"] |
|
|
|
|
|
|
|
|
|
|
|
class AdminBookAttributeSerializer(serializers.ModelSerializer): |
|
|
|
@ -524,16 +540,16 @@ class AdminBookReferenceListSerializer(serializers.ModelSerializer): |
|
|
|
] |
|
|
|
|
|
|
|
def get_volume(self, obj): |
|
|
|
vol = obj.volumes.first() |
|
|
|
return vol.title if vol else "" |
|
|
|
vols = list(obj.volumes.all()) |
|
|
|
return vols[0].title if vols else "" |
|
|
|
|
|
|
|
def get_publisher(self, obj): |
|
|
|
edition = obj.editions.first() |
|
|
|
return edition.publisher if edition else [] |
|
|
|
editions = list(obj.editions.all()) |
|
|
|
return editions[0].publisher if editions else [] |
|
|
|
|
|
|
|
def get_year_of_publication(self, obj): |
|
|
|
edition = obj.editions.first() |
|
|
|
return edition.year_of_publication if edition else "" |
|
|
|
editions = list(obj.editions.all()) |
|
|
|
return editions[0].year_of_publication if editions else "" |
|
|
|
|
|
|
|
|
|
|
|
class AdminBookReferenceDetailSerializer(serializers.ModelSerializer): |
|
|
|
|