From: Radek Czajka Date: Fri, 28 Oct 2011 15:26:02 +0000 (+0200) Subject: remove USE_CELERY setting, X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/9f46cd8bd84b9d2cd3febd80b3906260314de43f?ds=sidebyside remove USE_CELERY setting, some chunk form fixes --- diff --git a/apps/catalogue/forms.py b/apps/catalogue/forms.py index ad1e4d64..4e5b2cb4 100644 --- a/apps/catalogue/forms.py +++ b/apps/catalogue/forms.py @@ -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. # -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 _ @@ -77,11 +77,12 @@ class ChunkForm(forms.ModelForm): 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) + self.fields['gallery_start'].widget.attrs={'class': 'number-input'} self.fields['slug'].widget.attrs={'class': 'autoslug'} self.fields['title'].widget.attrs={'class': 'autoslug-source'} diff --git a/apps/catalogue/models/__init__.py b/apps/catalogue/models/__init__.py index d9a11dde..6161807b 100755 --- a/apps/catalogue/models/__init__.py +++ b/apps/catalogue/models/__init__.py @@ -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 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) diff --git a/apps/catalogue/models/chunk.py b/apps/catalogue/models/chunk.py index 770ddbf6..171ba533 100755 --- a/apps/catalogue/models/chunk.py +++ b/apps/catalogue/models/chunk.py @@ -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')) - 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) diff --git a/apps/catalogue/tasks.py b/apps/catalogue/tasks.py index 53b867b4..1bb4bc96 100644 --- a/apps/catalogue/tasks.py +++ b/apps/catalogue/tasks.py @@ -12,12 +12,8 @@ def _refresh_by_pk(cls, pk, language=None): 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 @@ -33,10 +29,6 @@ def _publishable_error(book, language=None): 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() diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 3459fdaf..89232ea0 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -285,6 +285,9 @@ def chunk_add(request, slug, chunk): 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()) diff --git a/redakcja/localsettings.sample b/redakcja/localsettings.sample index b2f2b5cb..509022e1 100644 --- a/redakcja/localsettings.sample +++ b/redakcja/localsettings.sample @@ -31,4 +31,4 @@ COMPRESS = False APICLIENT_WL_CONSUMER_KEY = None APICLIENT_WL_CONSUMER_SECRET = None -USE_CELERY = True +CELERY_ALWAYS_EAGER = False diff --git a/redakcja/static/css/filelist.css b/redakcja/static/css/filelist.css index 4aead730..f517ea6e 100644 --- a/redakcja/static/css/filelist.css +++ b/redakcja/static/css/filelist.css @@ -66,6 +66,10 @@ td { .editable input, .editable select, .editable textarea { width: 400px; } +.editable .number-input { + width: 100px; +} + #login-box { float: right;