From: Marek Stępniowski Date: Fri, 22 Aug 2008 12:16:16 +0000 (+0200) Subject: Various style changes. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/9c31d87a67dca4861c1e609001a6807eba9b6967?ds=inline;hp=4a6b5644b971d067f20fc05866b837dc30264f07 Various style changes. --- diff --git a/catalogue/forms.py b/catalogue/forms.py index b383f99ea..5708d897b 100644 --- a/catalogue/forms.py +++ b/catalogue/forms.py @@ -14,6 +14,14 @@ class SearchForm(forms.Form): self.fields['q'].widget.attrs['title'] = u'tytuł utworu, motyw lub kategoria' +class UserSetsForm(forms.Form): + def __init__(self, book, user, *args, **kwargs): + super(UserSetsForm, self).__init__(*args, **kwargs) + self.fields['set_ids'] = forms.ChoiceField( + choices=[(tag.id, tag.name) for tag in Tag.objects.filter(category='set', user=user)], + ) + + class BookSetsForm(forms.Form): def __init__(self, book, user, *args, **kwargs): super(BookSetsForm, self).__init__(*args, **kwargs) diff --git a/catalogue/models.py b/catalogue/models.py index b49747b18..483741be8 100644 --- a/catalogue/models.py +++ b/catalogue/models.py @@ -54,6 +54,14 @@ class Tag(TagBase): def __unicode__(self): return self.name + @staticmethod + def get_tag_list(tags): + if isinstance(tags, basestring): + tag_slugs = tags.split('/') + return [Tag.objects.get(slug=slug) for slug in tag_slugs] + else: + return TagBase.get_tag_list(tags) + class Book(models.Model): title = models.CharField(_('title'), max_length=120) diff --git a/catalogue/templatetags/catalogue.py b/catalogue/templatetags/catalogue.py index f2f35ddae..6b06f3802 100644 --- a/catalogue/templatetags/catalogue.py +++ b/catalogue/templatetags/catalogue.py @@ -3,19 +3,19 @@ from django import template from django.template import Node, Variable from django.utils.encoding import smart_str from django.core.urlresolvers import reverse -from django.contrib.auth import forms - +from django.contrib.auth.forms import UserCreationForm, AuthenticationForm + register = template.Library() -class RegistrationForm(forms.UserCreationForm): +class RegistrationForm(UserCreationForm): def as_ul(self): "Returns this form rendered as HTML
  • s -- excluding the ." return self._html_output(u'
  • %(errors)s%(label)s %(field)s%(help_text)s
  • ', u'
  • %s
  • ', '', u' %s', False) -class LoginForm(forms.AuthenticationForm): +class LoginForm(AuthenticationForm): def as_ul(self): "Returns this form rendered as HTML
  • s -- excluding the ." return self._html_output(u'
  • %(errors)s%(label)s %(field)s%(help_text)s
  • ', u'
  • %s
  • ', '', u' %s', False) diff --git a/media/css/master.css b/media/css/master.css index 41c40c0f5..4450eb131 100644 --- a/media/css/master.css +++ b/media/css/master.css @@ -388,3 +388,7 @@ em { list-style: none; } +#top-message { + background-color: #2F4110; + color: #FFF; +} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 03f8e198a..84cfd36b7 100644 --- a/templates/base.html +++ b/templates/base.html @@ -12,6 +12,9 @@ {% endblock %} +
    + {% chunk "top-message" %} +