remove USE_CELERY setting,
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Fri, 28 Oct 2011 15:26:02 +0000 (17:26 +0200)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Fri, 28 Oct 2011 15:26:02 +0000 (17:26 +0200)
some chunk form fixes

apps/catalogue/forms.py
apps/catalogue/models/__init__.py
apps/catalogue/models/chunk.py
apps/catalogue/tasks.py
apps/catalogue/views.py
redakcja/localsettings.sample
redakcja/static/css/filelist.css

index ad1e4d6..4e5b2cb 100644 (file)
@@ -3,7 +3,7 @@
 # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
 # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.contrib.auth.models import User
+from catalogue.models import User
 from django.db.models import Count
 from django import forms
 from django.utils.translation import ugettext_lazy as _
 from django.db.models import Count
 from django import forms
 from django.utils.translation import ugettext_lazy as _
@@ -77,11 +77,12 @@ class ChunkForm(forms.ModelForm):
 
     class Meta:
         model = Chunk
 
     class Meta:
         model = Chunk
-        fields = ['title', 'slug', 'user', 'stage']
+        fields = ['title', 'slug', 'gallery_start', 'user', 'stage']
         exclude = ['number']
 
     def __init__(self, *args, **kwargs):
         super(ChunkForm, self).__init__(*args, **kwargs)
         exclude = ['number']
 
     def __init__(self, *args, **kwargs):
         super(ChunkForm, self).__init__(*args, **kwargs)
+        self.fields['gallery_start'].widget.attrs={'class': 'number-input'}
         self.fields['slug'].widget.attrs={'class': 'autoslug'}
         self.fields['title'].widget.attrs={'class': 'autoslug-source'}
 
         self.fields['slug'].widget.attrs={'class': 'autoslug'}
         self.fields['title'].widget.attrs={'class': 'autoslug-source'}
 
index d9a11dd..6161807 100755 (executable)
@@ -7,3 +7,12 @@ from catalogue.models.chunk import Chunk
 from catalogue.models.publish_log import BookPublishRecord, ChunkPublishRecord
 from catalogue.models.book import Book
 from catalogue.models.listeners import *
 from catalogue.models.publish_log import BookPublishRecord, ChunkPublishRecord
 from catalogue.models.book import Book
 from catalogue.models.listeners import *
+
+from django.contrib.auth.models import User as AuthUser
+
+class User(AuthUser):
+    class Meta:
+        proxy = True
+
+    def __unicode__(self):
+        return "%s %s" % (self.first_name, self.last_name)
index 770ddbf..171ba53 100755 (executable)
@@ -22,7 +22,7 @@ class Chunk(dvcs_models.Document):
     number = models.IntegerField(_('number'))
     title = models.CharField(_('title'), max_length=255, blank=True)
     slug = models.SlugField(_('slug'))
     number = models.IntegerField(_('number'))
     title = models.CharField(_('title'), max_length=255, blank=True)
     slug = models.SlugField(_('slug'))
-    gallery_start = models.IntegerField(_('gallery start'), null=True, blank=True)
+    gallery_start = models.IntegerField(_('gallery start'), null=True, blank=True, default=1)
 
     # cache
     _short_html = models.TextField(null=True, blank=True, editable=False)
 
     # cache
     _short_html = models.TextField(null=True, blank=True, editable=False)
index 53b867b..1bb4bc9 100644 (file)
@@ -12,12 +12,8 @@ def _refresh_by_pk(cls, pk, language=None):
     finally:
         translation.activate(prev_language)
 
     finally:
         translation.activate(prev_language)
 
-if settings.USE_CELERY:
-    def refresh_instance(instance):
-        _refresh_by_pk.delay(type(instance), instance.pk, translation.get_language())
-else:
-    def refresh_instance(instance):
-        instance.refresh()
+def refresh_instance(instance):
+    _refresh_by_pk.delay(type(instance), instance.pk, translation.get_language())
 
 
 @task
 
 
 @task
@@ -33,10 +29,6 @@ def _publishable_error(book, language=None):
     finally:
         translation.activate(prev_language)
 
     finally:
         translation.activate(prev_language)
 
-if settings.USE_CELERY:
-    def publishable_error(book):
-        task = _publishable_error.delay(book, translation.get_language())
-        return task.wait()
-else:
-    def publishable_error(book):
-        return _publishable_error(book)
+def publishable_error(book):
+    return _publishable_error.delay(book, 
+        translation.get_language()).wait()
index 3459fda..89232ea 100644 (file)
@@ -285,6 +285,9 @@ def chunk_add(request, slug, chunk):
             doc.split(creator=creator,
                 slug=form.cleaned_data['slug'],
                 title=form.cleaned_data['title'],
             doc.split(creator=creator,
                 slug=form.cleaned_data['slug'],
                 title=form.cleaned_data['title'],
+                gallery_start=form.cleaned_data['gallery_start'],
+                user=form.cleaned_data['user'],
+                stage=form.cleaned_data['stage']
             )
 
             return http.HttpResponseRedirect(doc.book.get_absolute_url())
             )
 
             return http.HttpResponseRedirect(doc.book.get_absolute_url())
index b2f2b5c..509022e 100644 (file)
@@ -31,4 +31,4 @@ COMPRESS = False
 APICLIENT_WL_CONSUMER_KEY = None
 APICLIENT_WL_CONSUMER_SECRET = None
 
 APICLIENT_WL_CONSUMER_KEY = None
 APICLIENT_WL_CONSUMER_SECRET = None
 
-USE_CELERY = True
+CELERY_ALWAYS_EAGER = False
index 4aead73..f517ea6 100644 (file)
@@ -66,6 +66,10 @@ td {
 .editable input, .editable select, .editable textarea {
     width: 400px;
 }
 .editable input, .editable select, .editable textarea {
     width: 400px;
 }
+.editable .number-input {
+    width: 100px;
+}
+
 
 #login-box {
     float: right;
 
 #login-box {
     float: right;