add inline html
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Thu, 10 Jan 2013 13:28:15 +0000 (14:28 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Thu, 10 Jan 2013 13:28:15 +0000 (14:28 +0100)
migdal/migrations/0006_auto__add_field_entry_in_stream__add_field_entry_first_published_at.py
migdal/models.py
migdal/templates/migdal/entry/entry_begin.html
migdal/templates/migdal/entry/entry_detail.html
setup.py

index 8686f62..0153811 100644 (file)
@@ -27,7 +27,8 @@ class Migration(SchemaMigration):
                 else:
                     entry.first_published_at = (
                         entry.published_at_en or entry.published_at_pl)
                 else:
                     entry.first_published_at = (
                         entry.published_at_en or entry.published_at_pl)
-                entry.save()
+                orm.Entry.objects.filter(pk=entry.pk).update(
+                    first_published_at=entry.first_published_at)
 
     def backwards(self, orm):
         # Deleting field 'Entry.in_stream'
 
     def backwards(self, orm):
         # Deleting field 'Entry.in_stream'
index 4977562..3ab375d 100644 (file)
@@ -105,6 +105,12 @@ class Entry(models.Model):
             mail_text, settings.SERVER_EMAIL, [self.author_email]
         )
 
             mail_text, settings.SERVER_EMAIL, [self.author_email]
         )
 
+    def inline_html(self):
+        for att in self.attachment_set.all():
+            if att.file.name.endswith(".html"):
+                with open(att.file.path) as f:
+                    yield f.read()
+
 
 add_translatable(Entry, languages=app_settings.OPTIONAL_LANGUAGES, fields={
     'needed': models.CharField(_('needed'), max_length=1, db_index=True, choices=(
 
 add_translatable(Entry, languages=app_settings.OPTIONAL_LANGUAGES, fields={
     'needed': models.CharField(_('needed'), max_length=1, db_index=True, choices=(
index c26d6fd..e452a53 100644 (file)
 </div>
 
 {% if object.image %}
 </div>
 
 {% if object.image %}
+  <a href="{{ object.image.url }}">
     <img class="entry-picture" src="{% thumbnail object.image "200x150" as thumb %}
                     {{ thumb.url }}
                 {% empty %}
                     {{ object.image.url }}
     <img class="entry-picture" src="{% thumbnail object.image "200x150" as thumb %}
                     {{ thumb.url }}
                 {% empty %}
                     {{ object.image.url }}
-                {% endthumbnail %}" />
+                {% endthumbnail %}" /></a>
 {% endif %}
 <div class="lead">
 {{ object.lead }}
 {% endif %}
 <div class="lead">
 {{ object.lead }}
index 2e71d35..58a9491 100644 (file)
 {% entry_begin entry 1 %}
 <div class="body">
 {{ entry.body }}
 {% entry_begin entry 1 %}
 <div class="body">
 {{ entry.body }}
+
+{% for inline_html in entry.inline_html %}
+<div class="inline_html">
+    {{ inline_html|safe }}
+</div>
+{% endfor %}
+
 </div>
 
 <div style="clear: both;"></div>
 </div>
 
 <div style="clear: both;"></div>
index 3f77297..5be455f 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ def whole_trees(package_dir, paths):
 
 setup(
     name='django-migdal',
 
 setup(
     name='django-migdal',
-    version='0.2',
+    version='0.3',
     author='Radek Czajka',
     author_email='radoslaw.czajka@nowoczesnapolska.org.pl',
     url = '',
     author='Radek Czajka',
     author_email='radoslaw.czajka@nowoczesnapolska.org.pl',
     url = '',