From: Radek Czajka Date: Fri, 11 Jan 2013 10:08:21 +0000 (+0100) Subject: questions in sitemap X-Git-Url: https://git.mdrn.pl/prawokultury.git/commitdiff_plain/0ffd0b004ed18d4b39085677fb4966dc883cb4aa?ds=sidebyside;hp=0f0408963a87d86f7633eee0fbc995902e4c7aba questions in sitemap --- diff --git a/prawokultury/static/css/base.css b/prawokultury/static/css/base.css index 8f3fbfc..043d549 100644 --- a/prawokultury/static/css/base.css +++ b/prawokultury/static/css/base.css @@ -32,6 +32,9 @@ h1 { .notice { font-size: 1.3em; } +.normal { + font-size: 1.3em; } + .entry-wrapped .gallery-item { float: left; width: 300px; diff --git a/prawokultury/static/css/base.scss b/prawokultury/static/css/base.scss index 0ae42b9..73f82a2 100644 --- a/prawokultury/static/css/base.scss +++ b/prawokultury/static/css/base.scss @@ -40,6 +40,9 @@ h1 { .notice { font-size: 1.3em; } +.normal { + font-size: 1.3em; +} .entry-wrapped { .gallery-item{float:left; width:300px;text-align:center;margin-top:2em;} .gallery-image{height:240px; width:300px; display: table-cell; vertical-align:middle;} diff --git a/prawokultury/urls.py b/prawokultury/urls.py index 761afeb..b0a1f08 100644 --- a/prawokultury/urls.py +++ b/prawokultury/urls.py @@ -21,6 +21,16 @@ urlpatterns = patterns('', }), ) +if 'django.contrib.sitemaps' in settings.INSTALLED_APPS: + from migdal.sitemap import sitemaps as migdal_sitemaps + from questions.sitemap import sitemaps as question_sitemaps + sitemaps = dict(migdal_sitemaps.items() + question_sitemaps.items()) + urlpatterns += patterns('', + url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', { + 'sitemaps': sitemaps + }), + ) + if 'django_cas' in settings.INSTALLED_APPS: urlpatterns += patterns('', (r'^accounts/login/$', 'django_cas.views.login'), diff --git a/questions/admin.py b/questions/admin.py index d8676dc..ae6ac1d 100755 --- a/questions/admin.py +++ b/questions/admin.py @@ -7,7 +7,7 @@ class QuestionAdmin(admin.ModelAdmin): list_display = ('question', 'email', 'created_at', 'approved', 'answered', 'published') date_hierarchy = 'created_at' fields = ( - ('email', 'created_at'), + ('email', 'created_at', 'changed_at'), 'question', 'approved', 'edited_question', @@ -16,7 +16,7 @@ class QuestionAdmin(admin.ModelAdmin): ('published', 'published_at'), ) - readonly_fields = ['created_at', 'answered_at', 'published_at'] + readonly_fields = ['created_at', 'answered_at', 'published_at', 'changed_at'] admin.site.register(Question, QuestionAdmin) diff --git a/questions/migrations/0002_auto__add_field_question_changed_at.py b/questions/migrations/0002_auto__add_field_question_changed_at.py new file mode 100644 index 0000000..edb646c --- /dev/null +++ b/questions/migrations/0002_auto__add_field_question_changed_at.py @@ -0,0 +1,42 @@ +# -*- coding: 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 field 'Question.changed_at' + db.add_column('questions_question', 'changed_at', + self.gf('django.db.models.fields.DateTimeField')(auto_now=True, default=datetime.datetime.now, blank=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'Question.changed_at' + db.delete_column('questions_question', 'changed_at') + + + models = { + 'questions.question': { + 'Meta': {'ordering': "['-created_at']", 'object_name': 'Question'}, + '_answer_rendered': ('django.db.models.fields.TextField', [], {}), + 'answer': ('markupfield.fields.MarkupField', [], {'rendered_field': 'True', 'blank': 'True'}), + 'answer_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), + 'answered': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), + 'answered_at': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'approved': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'edited_question': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'published': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), + 'published_at': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'question': ('django.db.models.fields.TextField', [], {'db_index': 'True'}) + } + } + + complete_apps = ['questions'] \ No newline at end of file diff --git a/questions/models.py b/questions/models.py index 47dc697..94c6e1d 100644 --- a/questions/models.py +++ b/questions/models.py @@ -11,6 +11,7 @@ class Question(models.Model): email = models.EmailField(_('contact e-mail'), null=True, blank=True) question = models.TextField(_('question'), db_index=True) created_at = models.DateTimeField(_('created at'), auto_now_add=True) + changed_at = models.DateTimeField(_('changed at'), auto_now=True) approved = models.BooleanField(_('approved'), default=False) edited_question = models.TextField(_('edited question'), db_index=True, null=True, blank=True, help_text=_("Leave empty if question doesn't need editing.")) diff --git a/questions/sitemap.py b/questions/sitemap.py new file mode 100755 index 0000000..731cd26 --- /dev/null +++ b/questions/sitemap.py @@ -0,0 +1,20 @@ +from django.contrib.sitemaps import Sitemap +from .models import Question + +class QuestionSitemap(Sitemap): + changefreq = "never" + priority = 0.5 + + def items(self): + return Question.objects.filter(published=True) + + def lastmod(self, obj): + return obj.changed_at + + def location(self, obj): + return obj.get_absolute_url() + + +sitemaps = { + "question": QuestionSitemap, +} diff --git a/questions/templates/questions/question_detail.html b/questions/templates/questions/question_detail.html index be19018..5c6535a 100755 --- a/questions/templates/questions/question_detail.html +++ b/questions/templates/questions/question_detail.html @@ -1,11 +1,14 @@ {% extends "base.html" %} +{% load url from future %} {% block "titleextra" %}{{ question }} :: {% endblock %} {% block "body" %}

{{ question }}

+
{{ question.answer }}

Wróć do listy pytań.

+
{% endblock %} \ No newline at end of file diff --git a/questions/templates/questions/question_form.html b/questions/templates/questions/question_form.html index d712219..40b5341 100755 --- a/questions/templates/questions/question_form.html +++ b/questions/templates/questions/question_form.html @@ -5,7 +5,7 @@

Pierwsza pomoc w prawie autorskim: pytanie do prawnika

- +
{% csrf_token %} @@ -13,6 +13,7 @@
+
{% endblock %} \ No newline at end of file diff --git a/questions/templates/questions/question_list.html b/questions/templates/questions/question_list.html index 9432850..0b830e2 100755 --- a/questions/templates/questions/question_list.html +++ b/questions/templates/questions/question_list.html @@ -5,8 +5,9 @@ {% block "body" %}

Pierwsza pomoc w prawie autorskim

-

Jeśli rozwiązania Twojego problemu nie ma na tej stronie, -zajrzyj do naszego podręcznika. Jeśli i to nie pomoże, +

+

Jeśli rozwiązania Twojego problemu nie ma na tej stronie, +zajrzyj do naszego podręcznika. Jeśli i to nie pomoże, zadaj pytanie naszemu prawnikowi.

+
{% endblock %} \ No newline at end of file diff --git a/questions/templates/questions/question_thanks.html b/questions/templates/questions/question_thanks.html index b137678..639d36f 100755 --- a/questions/templates/questions/question_thanks.html +++ b/questions/templates/questions/question_thanks.html @@ -4,6 +4,8 @@ {% block "body" %}

Dziękujemy za przesłanie pytania

+
??? +
{% endblock %} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 303f175..757345b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ fnpdjango>=0.1.4,<0.2 textile django-markupfield django-gravatar -django_comments_xtd +django_comments_xtd==1.0a5 django-pipeline>=1.2,<1.3 #pyScss