Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
Fix module import clearing literature
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiphoseer committed Jun 6, 2017
1 parent 0081880 commit a85e2a5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pyBuchaktion/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,11 @@ def save(self, obj, data):
ids = []
for book in self.clean(data):
literature, created = Literature.objects.get_or_create(
book=book, module=obj, source__in=(Literature.TUCAN, Literature.STAFF)
book=book, module=obj, source=Literature.TUCAN,
)
ids.append(literature.pk)
obj.refresh_from_db(fields=['literature',])
Literature.objects.filter(source=Literature.TUCAN).exclude(pk__in=ids).delete()
Literature.objects.filter(source=Literature.TUCAN, module=obj).exclude(pk__in=ids).delete()

def get_value(self, obj):
return Book.objects.filter(
Expand Down Expand Up @@ -491,7 +491,6 @@ class ModuleCategoryResource(ModelResource):
class Meta:
model = ModuleCategory
import_id_fields = (
'id',
'name_de',
)
fields = import_id_fields
Expand Down

0 comments on commit a85e2a5

Please sign in to comment.