class Meta:
model = Tag
- fields = ['name', 'url', 'sort_key', 'description']
+ fields = [
+ 'name', 'url', 'sort_key',
+ 'description',
+ 'description_pl',
+ 'plural', 'genre_epoch_specific',
+ 'adjective_feminine_singular', 'adjective_nonmasculine_plural',
+ 'genitive', 'collective_noun',
+ ]
+ write_only_fields = [
+ 'description_pl',
+ 'plural', 'genre_epoch_specific',
+ 'adjective_feminine_singular', 'adjective_nonmasculine_plural',
+ 'genitive', 'collective_noun',
+ ]
class TranslatorSerializer(serializers.Serializer):
slug=self.kwargs['slug']
)
except Http404:
- if self.request.method == 'PUT':
+ if self.request.method == 'POST':
return Tag(
category=self.kwargs['category'],
slug=self.kwargs['slug']
def post(self, request, **kwargs):
data = json.loads(request.POST.get('data'))
- desc = data['description_pl']
+ fields = {
+ "description_pl": "description_pl",
+ "plural": "plural",
+ "is_epoch_specific": "genre_epoch_specific",
+ "collective_noun": "collective_noun",
+ "adjective_feminine_singular": "adjective_feminine_singular",
+ "adjective_nonmasculine_plural": "adjective_nonmasculine_plural",
+ }
obj = self.get_object()
- obj.description_pl = desc
- obj.save(update_fields=['description_pl'], quick=True)
+ for data_field, model_field in fields.items():
+ setattr(obj, model_field, data.get(data_field, getattr(obj, model_field)))
+ obj.save(update_fields=fields.values(), quick=True)
return Response({})
p = []
for sublist in pieces:
for item in sublist[:-2]:
- p.append(item) + ','
+ p.append(item + ',')
for item in sublist[-2:-1]:
- p.append(item) + ' i'
+ p.append(item + ' i')
p.append(sublist[-1])
return ' '.join(p)
is_set = len(tags) == 1 and tags[0].category == 'set'
is_theme = len(tags) == 1 and tags[0].category == 'theme'
+ has_theme = any((x.category == 'theme' for x in tags))
new_layout = request.EXPERIMENTS['layout']
if is_set and new_layout.value:
template = 'catalogue/2022/set_detail.html'
elif is_theme and new_layout.value:
template = 'catalogue/2022/theme_detail.html'
- elif new_layout.value:
+ elif new_layout.value and not has_theme:
template = 'catalogue/2022/author_detail.html'
else:
template = 'catalogue/tagged_object_list.html'
md = wl_dc_reader(xml)
m = md.getMap()
if book.parent:
- m['isPartOf'] = [str(WLURI.from_slug(book.parent.slug))]
+ m['isPartOf'] = [str(WLURI(book.parent.slug))]
return m
def record_for_book(self, book, headers_only=False):