update path after renaming author
This commit is contained in:
parent
b1ce39b51b
commit
c69484f6b3
2 changed files with 4 additions and 1 deletions
|
@ -8,7 +8,7 @@ import models
|
||||||
|
|
||||||
|
|
||||||
class TextAdmin(admin.ModelAdmin):
|
class TextAdmin(admin.ModelAdmin):
|
||||||
search_fields = ['title', 'authors__name']
|
search_fields = ['title', 'authors__name', 'languages__name']
|
||||||
list_display = ('title', 'version', 'file')
|
list_display = ('title', 'version', 'file')
|
||||||
list_filter = ('authors', )
|
list_filter = ('authors', )
|
||||||
admin.site.register(models.Text, TextAdmin)
|
admin.site.register(models.Text, TextAdmin)
|
||||||
|
|
|
@ -32,6 +32,9 @@ class Author(models.Model):
|
||||||
if not self.name_sort:
|
if not self.name_sort:
|
||||||
self.name_sort = oxlib.normalize.canonicalName(self.name)
|
self.name_sort = oxlib.normalize.canonicalName(self.name)
|
||||||
super(Author, self).save(*args, **kwargs)
|
super(Author, self).save(*args, **kwargs)
|
||||||
|
#update path in related texts
|
||||||
|
for text in self.texts.all():
|
||||||
|
text.save()
|
||||||
|
|
||||||
class Language(models.Model):
|
class Language(models.Model):
|
||||||
name = models.CharField(blank=True, max_length=1000)
|
name = models.CharField(blank=True, max_length=1000)
|
||||||
|
|
Loading…
Reference in a new issue