From: Lukasz Anwajler <lukasz@anwajler.com>
Date: Mon, 22 Nov 2010 20:17:38 +0000 (-0600)
Subject: Fixes #925 (xml source link on book's page).
X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/84aecebd96f2bc8a27396ecf10c409a8b91e1bcc?ds=sidebyside;hp=2c6c52b2ce930a558f7ce64e475e7ae66dc90163

Fixes #925 (xml source link on book's page).
Minor fix: non-standard (mp3, ogg, odt, daisy) media for book are not required anymore in admin.
---

diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py
index f811461be..98e37c1af 100644
--- a/apps/catalogue/models.py
+++ b/apps/catalogue/models.py
@@ -208,7 +208,7 @@ class Book(models.Model):
     epub_file     = models.FileField(_('EPUB file'), upload_to=book_upload_path('epub'), blank=True)    
     txt_file      = models.FileField(_('TXT file'), upload_to=book_upload_path('txt'), blank=True)        
     # other files
-    medias        = models.ManyToManyField(BookMedia)
+    medias        = models.ManyToManyField(BookMedia, blank=True)
     
     parent        = models.ForeignKey('self', blank=True, null=True, related_name='children')
     objects  = models.Manager()
diff --git a/wolnelektury/templates/catalogue/book_detail.html b/wolnelektury/templates/catalogue/book_detail.html
index 676cc0bb6..ffb586b8b 100644
--- a/wolnelektury/templates/catalogue/book_detail.html
+++ b/wolnelektury/templates/catalogue/book_detail.html
@@ -138,6 +138,9 @@
                     <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
                     {% endfor %}
                 </li>
+                <li>
+                    <a href="{{ book.xml_file.url }}">{% trans "View XML source" %}</a>
+                </li>                
             </ul>
             <h2>{% trans "Other resources" %}</h2>
             <ul>