# 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 _
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'}
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)
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)
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
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()
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())
APICLIENT_WL_CONSUMER_KEY = None
APICLIENT_WL_CONSUMER_SECRET = None
-USE_CELERY = True
+CELERY_ALWAYS_EAGER = False
.editable input, .editable select, .editable textarea {
width: 400px;
}
+.editable .number-input {
+ width: 100px;
+}
+
#login-box {
float: right;