remove topik object
authorFrédéric Péters <fpeters@0d.be>
Thu, 11 Jun 2020 10:50:04 +0000 (12:50 +0200)
committerFrédéric Péters <fpeters@0d.be>
Thu, 11 Jun 2020 10:51:47 +0000 (12:51 +0200)
panikombo/forms.py
panikombo/migrations/0005_topik.py
panikombo/migrations/0015_auto_20200611_1250.py [new file with mode: 0644]
panikombo/models.py
panikombo/templates/panikombo/topik_form.html [deleted file]
panikombo/views.py

index a366e75..d51d1ce 100644 (file)
@@ -7,7 +7,7 @@ from taggit.forms import TagWidget
 from emissions.models import SoundFile, Episode
 
 from .models import (SoundCell, EpisodeCell, EpisodeAutoSelectionCell,
-        NewsItemAutoSelectionCell, Topik)
+        NewsItemAutoSelectionCell)
 from .views import soundfiles, episodes
 
 class SoundFileWidget(HeavySelect2Widget):
@@ -62,9 +62,3 @@ class NewsItemAutoSelectionCellForm(forms.ModelForm):
         model = NewsItemAutoSelectionCell
         fields = ('title', 'tags', 'and_tags', 'category', 'future')
         widgets = {'tags': TagWidget()}
-
-
-class TopikEditForm(forms.ModelForm):
-    class Meta:
-        model = Topik
-        fields = ('image',)
index 226df96..d2e339b 100644 (file)
@@ -2,7 +2,6 @@
 from __future__ import unicode_literals
 
 from django.db import models, migrations
-import panikombo.models
 
 
 class Migration(migrations.Migration):
@@ -17,7 +16,7 @@ class Migration(migrations.Migration):
             name='Topik',
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
-                ('image', models.ImageField(max_length=250, upload_to=panikombo.models.get_topik_image_path, null=True, verbose_name='Image', blank=True)),
+                ('image', models.ImageField(max_length=250, null=True, verbose_name='Image', blank=True)),
                 ('got_focus', models.DateTimeField(default=None, null=True, blank=True)),
                 ('has_focus', models.BooleanField(default=False)),
                 ('page', models.ForeignKey(to='data.Page')),
diff --git a/panikombo/migrations/0015_auto_20200611_1250.py b/panikombo/migrations/0015_auto_20200611_1250.py
new file mode 100644 (file)
index 0000000..dbbdb14
--- /dev/null
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.29 on 2020-06-11 12:50
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('panikombo', '0014_remove_itemtopik_topik'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='topik',
+            name='page',
+        ),
+        migrations.RemoveField(
+            model_name='topikcell',
+            name='groups',
+        ),
+        migrations.RemoveField(
+            model_name='topikcell',
+            name='page',
+        ),
+        migrations.RemoveField(
+            model_name='topikcell',
+            name='topik',
+        ),
+        migrations.DeleteModel(
+            name='Topik',
+        ),
+        migrations.DeleteModel(
+            name='TopikCell',
+        ),
+    ]
index 2907b86..905b7f2 100644 (file)
@@ -215,45 +215,9 @@ class NewsItemAutoSelectionCell(CellBase):
         return ''
 
 
-def get_topik_image_path(instance, filename):
-    return os.path.join('images', 'topik', instance.page.slug,
-            os.path.basename(filename))
-
-@python_2_unicode_compatible
-class Topik(models.Model):
-    page = models.ForeignKey('data.Page')
-    image = models.ImageField(_('Image'),
-            upload_to=get_topik_image_path, max_length=250, null=True, blank=True)
-
-    # denormalized from Focus
-    got_focus = models.DateTimeField(default=None, null=True, blank=True)
-    has_focus = models.BooleanField(default=False)
-
-    def __str__(self):
-        if not self.page:
-            return super(Topik, self).__str__()
-        return force_text(self.page)
-
-
 class ItemTopik(models.Model):
     newsitem = models.ForeignKey('emissions.NewsItem', verbose_name=_('News Item'),
             null=True, blank=True)
     episode = models.ForeignKey('emissions.Episode', verbose_name=_('Episode'),
             null=True, blank=True)
     page = models.ForeignKey('data.Page', null=True, blank=True)
-
-
-@register_cell_class
-class TopikCell(CellBase):
-    topik = models.ForeignKey(Topik, null=True)
-    text = RichTextField(_('Text'), blank=True, null=True)
-
-    template_name = 'panikombo/topik-cell.html'
-
-    class Meta:
-        verbose_name = _('Topik')
-
-    def get_additional_label(self):
-        if not self.topik:
-            return ''
-        return self.topik.page.title
diff --git a/panikombo/templates/panikombo/topik_form.html b/panikombo/templates/panikombo/topik_form.html
deleted file mode 100644 (file)
index fed894e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-{% extends "combo/manager_base.html" %}
-{% load i18n %}
-
-{% block appbar %}
-<h2>{% trans 'Topik Options' %}</h2>
-{% endblock %}
-
-{% block content %}
-<form method="post" enctype="multipart/form-data">
-{% csrf_token %}
-{{form.as_p}}
-  <div class="buttons">
-    <button>{% trans "Save" %}</button>
-    {% if object.id %}
-    <a class="cancel" href="{{ object.get_absolute_url }}">{% trans 'Cancel' %}</a>
-    {% else %}
-    <a class="cancel" href="{% url 'combo-manager-homepage' %}">{% trans 'Cancel' %}</a>
-    {% endif %}
-  </div>
-</form>
-{% endblock %}
-
index 4541dab..faa454e 100644 (file)
@@ -5,7 +5,7 @@ from django.views.generic.edit import UpdateView
 import django_select2.views
 
 from emissions.models import SoundFile, Episode
-from .models import Topik
+
 
 class SoundFilesView(django_select2.views.AutoResponseView):
     def get(self, request, *args, **kwargs):
@@ -58,16 +58,3 @@ class EpisodesView(django_select2.views.AutoResponseView):
 
 
 episodes = EpisodesView.as_view()
-
-
-class TopikEdit(UpdateView):
-    model = Topik
-
-    def get_form_class(self):
-        from .forms import TopikEditForm
-        return TopikEditForm
-
-    def get_success_url(self):
-        return reverse('combo-manager-page-view', kwargs={'pk': self.object.page.id})
-
-topik_edit = TopikEdit.as_view()