From: Radek Czajka Date: Thu, 10 Jan 2013 13:28:15 +0000 (+0100) Subject: add inline html X-Git-Tag: 0.3.1~3 X-Git-Url: https://git.mdrn.pl/django-migdal.git/commitdiff_plain/402a579c119c6494404699aa6e21b16579ca278b?ds=sidebyside add inline html --- diff --git a/migdal/migrations/0006_auto__add_field_entry_in_stream__add_field_entry_first_published_at.py b/migdal/migrations/0006_auto__add_field_entry_in_stream__add_field_entry_first_published_at.py index 8686f62..0153811 100644 --- a/migdal/migrations/0006_auto__add_field_entry_in_stream__add_field_entry_first_published_at.py +++ b/migdal/migrations/0006_auto__add_field_entry_in_stream__add_field_entry_first_published_at.py @@ -27,7 +27,8 @@ class Migration(SchemaMigration): 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' diff --git a/migdal/models.py b/migdal/models.py index 4977562..3ab375d 100644 --- a/migdal/models.py +++ b/migdal/models.py @@ -105,6 +105,12 @@ class Entry(models.Model): 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=( diff --git a/migdal/templates/migdal/entry/entry_begin.html b/migdal/templates/migdal/entry/entry_begin.html index c26d6fd..e452a53 100644 --- a/migdal/templates/migdal/entry/entry_begin.html +++ b/migdal/templates/migdal/entry/entry_begin.html @@ -22,11 +22,12 @@ {% if object.image %} + + {% endthumbnail %}" /> {% endif %}
{{ object.lead }} diff --git a/migdal/templates/migdal/entry/entry_detail.html b/migdal/templates/migdal/entry/entry_detail.html index 2e71d35..58a9491 100644 --- a/migdal/templates/migdal/entry/entry_detail.html +++ b/migdal/templates/migdal/entry/entry_detail.html @@ -28,6 +28,13 @@ {% entry_begin entry 1 %}
{{ entry.body }} + +{% for inline_html in entry.inline_html %} +
+ {{ inline_html|safe }} +
+{% endfor %} +
diff --git a/setup.py b/setup.py index 3f77297..5be455f 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ def whole_trees(package_dir, paths): setup( name='django-migdal', - version='0.2', + version='0.3', author='Radek Czajka', author_email='radoslaw.czajka@nowoczesnapolska.org.pl', url = '',