cleaned code and fix themes css
--HG-- rename : apps/forum/templates/forum/head.html => apps/forum/templates/forum/header.html
This commit is contained in:
parent
3af483e6a0
commit
c4f2e7aae8
9 changed files with 16 additions and 97 deletions
|
@ -239,89 +239,6 @@ class UserSearchForm(forms.Form):
|
|||
else:
|
||||
return qs
|
||||
|
||||
class PostSearchForm(forms.Form):
|
||||
keywords = forms.CharField(required=False, label=_('Keyword search'),
|
||||
widget=forms.TextInput(attrs={'size':'40', 'maxlength':'100'}))
|
||||
author = forms.CharField(required=False, label=_('Author search'),
|
||||
widget=forms.TextInput(attrs={'size':'25', 'maxlength':'25'}))
|
||||
forum = forms.CharField(required=False, label=_('Forum'))
|
||||
search_in = forms.ChoiceField(choices=SEARCH_IN_CHOICES, label=_('Search in'))
|
||||
sort_by = forms.ChoiceField(choices=SORT_POST_BY_CHOICES, label=_('Sort by'))
|
||||
sort_dir = forms.ChoiceField(choices=SORT_DIR_CHOICES, label=_('Sort order'))
|
||||
show_as = forms.ChoiceField(choices=SHOW_AS_CHOICES, label=_('Show results as'))
|
||||
|
||||
def filter(self, qs):
|
||||
if self.is_valid():
|
||||
keywords = self.cleaned_data['keywords']
|
||||
author = self.cleaned_data['author']
|
||||
forum = self.cleaned_data['forum']
|
||||
search_in = self.cleaned_data['search_in']
|
||||
sort_by = self.cleaned_data['sort_by']
|
||||
sort_dir = self.cleaned_data['sort_dir']
|
||||
|
||||
if sort_by=='0':
|
||||
if sort_dir=='ASC':
|
||||
if search_in=='all':
|
||||
return qs.filter(Q(topic__name__contains=keywords)).order_by('created')
|
||||
elif search_in=='message':
|
||||
return qs.filter(body__contains=keywords, user__username__contains=author).order_by('created')
|
||||
elif search_in=='topic':
|
||||
return qs.filter(topic__contains=keywords, user__username__contains=author).order_by('created')
|
||||
elif sort_dir=='DESC':
|
||||
if search_in=='all':
|
||||
return qs.filter(Q(topic__contains=keywords) | Q(body__contains=keywords) & Q(user__username__contains=author)).order_by('-created')
|
||||
elif search_in=='message':
|
||||
return qs.filter(body__contains=keywords, user__username__contains=author).order_by('-created')
|
||||
elif search_in=='topic':
|
||||
return qs.filter(topic__contains=keywords, user__username__contains=author).order_by('-created')
|
||||
elif sort_by=='1':
|
||||
if sort_dir=='ASC':
|
||||
if search_in=='all':
|
||||
return qs.filter(Q(topic__contains=keywords) | Q(body__contains=keywords) & Q(user__username__contains=author)).order_by('user')
|
||||
elif search_in=='message':
|
||||
return qs.filter(body__contains=keywords, user__username__contains=author).order_by('user')
|
||||
elif search_in=='topic':
|
||||
return qs.filter(topic__contains=keywords, user__username__contains=author).order_by('user')
|
||||
elif sort_dir=='DESC':
|
||||
if search_in=='all':
|
||||
return qs.filter(Q(topic__contains=keywords) | Q(body__contains=keywords) & Q(user__username__contains=author)).order_by('-user')
|
||||
elif search_in=='message':
|
||||
return qs.filter(body__contains=keywords, user__username__contains=author).order_by('-user')
|
||||
elif search_in=='topic':
|
||||
return qs.filter(topic__contains=keywords, user__username__contains=author).order_by('-user')
|
||||
elif sort_by=='2':
|
||||
if sort_dir=='ASC':
|
||||
if search_in=='all':
|
||||
return qs.filter((Q(topic__contains=keywords) | Q(body__contains=keywords)) & Q(user__username__contains=author)).order_by('topic')
|
||||
elif search_in=='message':
|
||||
return qs.filter(body__contains=keywords, user__username__contains=author).order_by('topic')
|
||||
elif search_in=='topic':
|
||||
return qs.filter(topic__contains=keywords, user__username__contains=author).order_by('topic')
|
||||
elif sort_dir=='DESC':
|
||||
if search_in=='all':
|
||||
return qs.filter((Q(topic__contains=keywords) | Q(body__contains=keywords)) & Q(user__username__contains=author)).order_by('-topic')
|
||||
elif search_in=='message':
|
||||
return qs.filter(body__contains=keywords, user__username__contains=author).order_by('-topic')
|
||||
elif search_in=='topic':
|
||||
return qs.filter(topic__contains=keywords, user__username__contains=author).order_by('-topic')
|
||||
elif sort_by=='3':
|
||||
if sort_dir=='ASC':
|
||||
if search_in=='all':
|
||||
return qs.filter((Q(topic__contains=keywords) | Q(body__contains=keywords)) & Q(user__username__contains=author)).order_by('topic__forum')
|
||||
elif search_in=='message':
|
||||
return qs.filter(body__contains=keywords, user__username__contains=author).order_by('topic__forum')
|
||||
elif search_in=='topic':
|
||||
return qs.filter(topic__contains=keywords, user__username__contains=author).order_by('topic__forum')
|
||||
elif sort_dir=='DESC':
|
||||
if search_in=='all':
|
||||
return qs.filter((Q(topic__contains=keywords) | Q(body__contains=keywords)) & Q(user__username__contains=author)).order_by('-topic__forum')
|
||||
elif search_in=='message':
|
||||
return qs.filter(body__contains=keywords, user__username__contains=author).order_by('-topic__forum')
|
||||
elif search_in=='topic':
|
||||
return qs.filter(topic__contains=keywords, user__username__contains=author).order_by('-topic__forum')
|
||||
else:
|
||||
return qs
|
||||
|
||||
|
||||
class ReputationForm(forms.ModelForm):
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ class Profile(models.Model):
|
|||
location = models.CharField(_('Location'), max_length=30, blank=True, default='')
|
||||
signature = models.TextField(_('Signature'), blank=True, default='', max_length=forum_settings.SIGNATURE_MAX_LENGTH)
|
||||
time_zone = models.FloatField(_('Time zone'), choices=TZ_CHOICES, default=float(forum_settings.DEFAULT_TIME_ZONE))
|
||||
language = models.CharField(_('Language'), max_length=3, blank=True, default='', choices=settings.LANGUAGES)
|
||||
language = models.CharField(_('Language'), max_length=3, default='', choices=settings.LANGUAGES)
|
||||
avatar = ExtendedImageField(_('Avatar'), blank=True, default='', upload_to=forum_settings.AVATARS_UPLOAD_TO, width=forum_settings.AVATAR_WIDTH, height=forum_settings.AVATAR_HEIGHT)
|
||||
theme = models.CharField(_('Theme'), choices=THEME_CHOICES, max_length=80, default='')
|
||||
show_avatar = models.BooleanField(_('Show avatar'), blank=True, default=True)
|
||||
|
|
|
@ -48,20 +48,20 @@
|
|||
{% block extra_meta %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% include 'forum/head.html' %}
|
||||
{% include 'forum/header.html' %}
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
<div id="brdfooter" class="block">
|
||||
<h2><span>{% trans "Board footer" %}</span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
{% block controls %}
|
||||
{% endblock %}
|
||||
<p class="conr">Powered by <a href="http://www.djangobb.org/">DjangoBB</a></p>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<h2><span>{% trans "Board footer" %}</span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
{% block controls %}
|
||||
{% endblock %}
|
||||
<p class="conr">Powered by <a href="http://www.djangobb.org/">DjangoBB</a></p>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -33,7 +33,9 @@
|
|||
<div class="infldset">
|
||||
<label><strong>{{ form.email.label }}</strong><br>
|
||||
{{ form.email }}<br></label>
|
||||
{% if request.user.is_superuser %}
|
||||
<p><a href="{% url misc %}?mail_to={{ profile }}">{% trans "Send e-mail" %}</a></p>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
|
|
|
@ -14,7 +14,7 @@ from django.utils import translation
|
|||
|
||||
from apps.forum.util import render_to, paged, build_form, paginate, set_language
|
||||
from apps.forum.models import Category, Forum, Topic, Post, Profile, Read, Reputation, Report, PrivateMessage
|
||||
from apps.forum.forms import AddPostForm, EditPostForm, UserSearchForm, PostSearchForm, ReputationForm, MailToForm, EssentialsProfileForm, PersonalProfileForm, MessagingProfileForm, PersonalityProfileForm, DisplayProfileForm, PrivacyProfileForm, ReportForm, UploadAvatarForm, CreatePMForm
|
||||
from apps.forum.forms import AddPostForm, EditPostForm, UserSearchForm, ReputationForm, MailToForm, EssentialsProfileForm, PersonalProfileForm, MessagingProfileForm, PersonalityProfileForm, DisplayProfileForm, PrivacyProfileForm, ReportForm, UploadAvatarForm, CreatePMForm
|
||||
from apps.forum.markups import mypostmarkup
|
||||
from apps.forum.templatetags import forum_extras
|
||||
from apps.forum import settings as forum_settings
|
||||
|
|
|
@ -274,7 +274,7 @@ TD DIV.tclcon {MARGIN-LEFT: 2.3em}
|
|||
|
||||
#brdfooter {
|
||||
width: auto;
|
||||
margin-bottom: 0;
|
||||
margin-bottom: 10px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: bottom left;
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ DIV.postlinksb {MARGIN-TOP: -6px}
|
|||
have a 6px space beneath them */
|
||||
|
||||
#brdstats {MARGIN-TOP: 12px}
|
||||
#brdfooter{MARGIN-BOTTOM: 0px}
|
||||
#brdfooter{MARGIN-BOTTOM: 10px}
|
||||
|
||||
/****************************************************************/
|
||||
/* 6. SPACING AROUND CONTENT */
|
||||
|
|
|
@ -274,7 +274,7 @@ TD DIV.tclcon {MARGIN-LEFT: 2.3em}
|
|||
|
||||
#brdfooter {
|
||||
width: auto;
|
||||
margin-bottom: 0;
|
||||
margin-bottom: 10px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: bottom left;
|
||||
}
|
||||
|
|
Reference in a new issue