From: Radek Czajka Date: Thu, 9 Jun 2011 12:12:57 +0000 (+0200) Subject: suggestions: fixes and missing files X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/237dc400a6995da6d8a439d4abb173eecbe74a01 suggestions: fixes and missing files --- diff --git a/apps/suggest/forms.py b/apps/suggest/forms.py index 5c034e654..76170e1c6 100644 --- a/apps/suggest/forms.py +++ b/apps/suggest/forms.py @@ -18,8 +18,15 @@ class SuggestForm(forms.Form): class PublishingSuggestForm(forms.Form): contact = forms.CharField(label=_('Contact'), max_length=120, required=False) - books = forms.CharField(label=_('books'), widget=forms.Textarea, required=True) - audiobooks = forms.CharField(label=_('audiobooks'), widget=forms.Textarea, required=True) + books = forms.CharField(label=_('books'), widget=forms.Textarea, required=False) + audiobooks = forms.CharField(label=_('audiobooks'), widget=forms.Textarea, required=False) + + def clean(self, *args, **kwargs): + if not self.cleaned_data['books'] and not self.cleaned_data['audiobooks']: + msg = _(u"One of these fields is required.") + self._errors["books"] = self.error_class([msg]) + self._errors["audiobooks"] = self.error_class([msg]) + return super(PublishingSuggestForm, self).clean(*args, **kwargs) def save(self, request): contact = self.cleaned_data['contact'] diff --git a/apps/suggest/locale/pl/LC_MESSAGES/django.mo b/apps/suggest/locale/pl/LC_MESSAGES/django.mo index 2e3e5d7e5..3990bea84 100644 Binary files a/apps/suggest/locale/pl/LC_MESSAGES/django.mo and b/apps/suggest/locale/pl/LC_MESSAGES/django.mo differ diff --git a/apps/suggest/locale/pl/LC_MESSAGES/django.po b/apps/suggest/locale/pl/LC_MESSAGES/django.po index a14e7f3a0..7fdcbb5b4 100644 --- a/apps/suggest/locale/pl/LC_MESSAGES/django.po +++ b/apps/suggest/locale/pl/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-09 12:31+0200\n" -"PO-Revision-Date: 2011-06-09 12:35+0100\n" +"POT-Creation-Date: 2011-06-09 13:06+0200\n" +"PO-Revision-Date: 2011-06-09 13:06+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -27,19 +27,25 @@ msgid "Description" msgstr "Opis" #: forms.py:21 +#: models.py:27 msgid "books" msgstr "książki" #: forms.py:22 +#: models.py:28 msgid "audiobooks" msgstr "audiobooki" -#: forms.py:55 +#: forms.py:26 +msgid "One of these fields is required." +msgstr "Proszę wypełnić co najmniej jedno z tych pól." + +#: forms.py:62 #: views.py:95 msgid "Thank you for your suggestion." msgstr "Dziękujemy za zgłoszenie." -#: forms.py:56 +#: forms.py:63 #: views.py:96 msgid "" "Thank you for your comment on WolneLektury.pl.\n" @@ -48,7 +54,7 @@ msgstr "" "Dziękujemy za zgłoszenie uwag do serwisu Wolne Lektury.\n" "Sugestia została przekazana koordynatorce projektu." -#: forms.py:62 +#: forms.py:69 #: views.py:102 msgid "Message sent automatically. Please do not reply." msgstr "Wiadomość wysłana automatycznie. Proszę nie odpowiadać." @@ -59,8 +65,6 @@ msgid "contact" msgstr "kontakt" #: models.py:11 -#: models.py:27 -#: models.py:28 msgid "description" msgstr "opis" diff --git a/apps/suggest/migrations/0002_auto__add_publishingsuggestion.py b/apps/suggest/migrations/0002_auto__add_publishingsuggestion.py new file mode 100644 index 000000000..8a52a7fbb --- /dev/null +++ b/apps/suggest/migrations/0002_auto__add_publishingsuggestion.py @@ -0,0 +1,88 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding model 'PublishingSuggestion' + db.create_table('suggest_publishingsuggestion', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('contact', self.gf('django.db.models.fields.CharField')(max_length=120, blank=True)), + ('books', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('audiobooks', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), + ('ip', self.gf('django.db.models.fields.IPAddressField')(max_length=15)), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), + )) + db.send_create_signal('suggest', ['PublishingSuggestion']) + + + def backwards(self, orm): + + # Deleting model 'PublishingSuggestion' + db.delete_table('suggest_publishingsuggestion') + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'unique': 'True'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'max_length': '30', 'unique': 'True'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'suggest.publishingsuggestion': { + 'Meta': {'ordering': "('-created_at',)", 'object_name': 'PublishingSuggestion'}, + 'audiobooks': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'books': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'contact': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) + }, + 'suggest.suggestion': { + 'Meta': {'ordering': "('-created_at',)", 'object_name': 'Suggestion'}, + 'contact': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['suggest'] diff --git a/apps/suggest/models.py b/apps/suggest/models.py index 492f4cecb..e58c9a805 100644 --- a/apps/suggest/models.py +++ b/apps/suggest/models.py @@ -24,8 +24,8 @@ class Suggestion(models.Model): class PublishingSuggestion(models.Model): contact = models.CharField(_('contact'), blank=True, max_length=120) - books = models.TextField(_('books')) - audiobooks = models.TextField(_('audiobooks')) + books = models.TextField(_('books'), null=True, blank=True) + audiobooks = models.TextField(_('audiobooks'), null=True, blank=True) created_at = models.DateTimeField(_('creation date'), auto_now_add=True) ip = models.IPAddressField(_('IP address')) user = models.ForeignKey(User, blank=True, null=True) diff --git a/apps/suggest/templates/publishing_suggest.html b/apps/suggest/templates/publishing_suggest.html new file mode 100755 index 000000000..a6ed283d5 --- /dev/null +++ b/apps/suggest/templates/publishing_suggest.html @@ -0,0 +1,15 @@ +{% load i18n %} +

{% trans "Didn't find a book? Make a suggestion." %}

+
+
    +
  1. {{ pubsuggest_form.contact.errors }} {{ pubsuggest_form.contact }}
  2. + +
  3. {% trans "I'd like to find in WolneLektury.pl these…" %}
  4. + +
  5. {{ pubsuggest_form.books.errors }} {{ pubsuggest_form.books }}
  6. + +
  7. {{ pubsuggest_form.audiobooks.errors }} {{ pubsuggest_form.audiobooks }}
  8. + +
  9. +
+
diff --git a/apps/suggest/templates/publishing_suggest_full.html b/apps/suggest/templates/publishing_suggest_full.html new file mode 100755 index 000000000..c5d8c2833 --- /dev/null +++ b/apps/suggest/templates/publishing_suggest_full.html @@ -0,0 +1,24 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}Sugestia do planu wydawniczego w WolneLektury.pl{% endblock %} + +{% block metadescription %}Sugestia do planu wydawniczego.{% endblock %} + +{% block bodyid %}suggest-publishing{% endblock %} + +{% block body %} +
+

{{ form.q }} {% trans "or" %} {% trans "return to main page" %}

+
+ +
+
+ +
+ {% include "publishing_suggest.html" %} + {% if response_data.message %} +

{{ response_data.message }}

+ {% endif %} +
+{% endblock %}