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)
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)
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 <li>s -- excluding the <ul></ul>."
return self._html_output(u'<li>%(errors)s%(label)s %(field)s<span class="help-text">%(help_text)s</span></li>', u'<li>%s</li>', '</li>', u' %s', False)
-class LoginForm(forms.AuthenticationForm):
+class LoginForm(AuthenticationForm):
def as_ul(self):
"Returns this form rendered as HTML <li>s -- excluding the <ul></ul>."
return self._html_output(u'<li>%(errors)s%(label)s %(field)s<span class="help-text">%(help_text)s</span></li>', u'<li>%s</li>', '</li>', u' %s', False)
list-style: none;
}
+#top-message {
+ background-color: #2F4110;
+ color: #FFF;
+}
\ No newline at end of file
{% endblock %}
</head>
<body id="{% block bodyid %}base{% endblock %}">
+ <div id="top-message">
+ {% chunk "top-message" %}
+ </div>
<div id="header">
<div id="logo">
<a href="/"><img src="/media/img/logo.png" alt="WolneLektury.pl - logo" /></a>
{% if user.is_authenticated %}
<p>
Zalogowany jako <strong>{{ user.username }}</strong>
+ | <a href="#">Zestawy</a>
{% if user.is_staff %}
| <a href="/admin/">Administracja</a>
{% endif %}