diff --git a/newsbox/admin.py b/newsbox/admin.py index a07d27409024f5475b727e2436d378f63dfd5aab..9449fada7ab3fbd2a33870e0b9c29fcb59f0bef7 100644 --- a/newsbox/admin.py +++ b/newsbox/admin.py @@ -107,12 +107,12 @@ def add_fields_to_fieldset( class NewsboxBaseAdmin(admin.ModelAdmin): - list_filter = ('newsbox_publication_start_date', 'newsbox_published', ) + list_filter = ('newsbox_publication_start_date', 'newsbox_status', ) list_display = ['get_newsbox_title', 'newsbox_date_short', 'changestatus_link'] list_display_links = ('get_newsbox_title',) fieldsets = [ (None, { - 'fields': ['newsbox_title', 'newsbox_slug', 'newsbox_date', 'newsbox_published', ], }), + 'fields': ['newsbox_title', 'newsbox_slug', 'newsbox_date', 'newsbox_status', ], }), (_('Content'), { 'fields': ['newsbox_summary', 'newsbox_body'], }), ] actions = ['publish', 'unpublish'] @@ -124,7 +124,7 @@ class NewsboxBaseAdmin(admin.ModelAdmin): return pfields def changestatus_link(self, obj): - if obj.newsbox_published: + if obj.newsbox_status == obj.STATUS_PUBLISHED: title = _('Unpublish this %s') % six.text_type( obj._meta.verbose_name) icon_url = static('admin/img/icon-yes.gif') @@ -136,10 +136,10 @@ class NewsboxBaseAdmin(admin.ModelAdmin): self.model._meta.app_label) return '<a href="%s" title="%s"><img src="%s" alt="%s" /></a>' % ( reverse('admin:%s' % url_name, args=[obj.pk, ]), - title, icon_url, obj.newsbox_published) + title, icon_url, obj.get_newsbox_status_display()) changestatus_link.allow_tags = True - changestatus_link.admin_order_field = 'newsbox_published' + changestatus_link.admin_order_field = 'newsbox_status' changestatus_link.short_description = _('published') def newsbox_date_short(self, obj): @@ -188,30 +188,22 @@ class NewsboxBaseAdmin(admin.ModelAdmin): _('You do not have permission to publish this %s') % (six.text_type(self.model._meta.verbose_name),)) - obj.newsbox_published = not obj.newsbox_published + old_status = obj.newsbox_status + if obj.newsbox_status == obj.STATUS_PUBLISHED: + obj.newsbox_status = obj.STATUS_ARCHIVED + else: + obj.newsbox_status = obj.STATUS_PUBLISHED obj.save() - if obj.newsbox_published: - log_msg = 'publication status set ON' - messages.info( - request, - _( - 'The %(objtype)s "%(objtitle)s" has been ' - 'successfully published' - ) % { - 'objtype': six.text_type(self.model._meta.verbose_name), - 'objtitle': six.text_type(obj)} - ) + log_msg = _('publication status changed from %(old)s to %(new)s') % { + 'old': old_status, + 'new_status': obj.newsbox_status, + } + if obj.newsbox_status == obj.STATUS_PUBLISHED: + msg = _('The %(objtype)s "%(objtitle)s" has been successfully published') else: - log_msg = _('publication status set OFF') - messages.info( - request, - _( - 'The %(objtype)s "%(objtitle)s" has been ' - 'successfully unpublished' - ) % { - 'objtype': six.text_type(self.model._meta.verbose_name), - 'objtitle': obj} - ) + msg = _('The %(objtype)s "%(objtitle)s" has been successfully unpublished') + messages.info(request, msg % {'objtype': six.text_type(self.model._meta.verbose_name), + 'objtitle': six.text_type(obj)}) LogEntry.objects.log_action( user_id=request.user.id, content_type_id=ContentType.objects.get_for_model(self.model).pk, @@ -275,11 +267,10 @@ class NewsboxBaseAdmin(admin.ModelAdmin): 'objtitle': last_obj_ok, }) else: messages.success(request, ungettext_lazy( - '%(nb)d %(objtype_sing)s has been published', - '%(nb)d %(objtype_plural)s have been published', + '%(nb)d %(objtype)s has been published', + '%(nb)d %(objtype)s have been published', ok) % {'nb': ok, - 'objtype_sing': self.model._meta.verbose_name, - 'objtype_plural': self.model._meta.verbose_name_plural}) + 'objtype': self.model._meta.verbose_name_plural,}) publish.short_description = _('Publish selected %(verbose_name_plural)s') def unpublish(self, request, queryset): @@ -317,13 +308,11 @@ class NewsboxBaseAdmin(admin.ModelAdmin): 'objtitle': last_obj_ok, }) else: messages.success(request, ungettext_lazy( - '%(nb)d %(objtype_sing)s has been unpublished', - '%(nb)d %(objtype_plural)s have been unpublished', + '%(nb)d %(objtype)s has been unpublished', + '%(nb)d %(objtype)s have been unpublished', ok) % {'nb': ok, - 'objtype_sing': self.model._meta.verbose_name, - 'objtype_plural': self.model._meta.verbose_name_plural}) - unpublish.short_description = _( - 'Unpublish selected %(verbose_name_plural)s') + 'objtype': self.model._meta.verbose_name_plural}) + unpublish.short_description = _('Unpublish selected %(verbose_name_plural)s') def ensure_slug_uniq_queryset(self, request, obj, slug): y, m, d = (obj.newsbox_publication_start_date.year, @@ -389,14 +378,16 @@ class NewsboxExpiredAdmin(NewsboxBaseAdmin): def get_fieldsets(self, request, obj=None): fieldsets = super(NewsboxExpiredAdmin, self).get_fieldsets(request, obj) - - remove_field_from_fieldsets('newsbox_published', fieldsets) + for fieldset in fieldsets: + if 'newsbox_publication_end_date' in fieldset[1]['fields']: + return fieldsets + remove_field_from_fieldsets('newsbox_status', fieldsets) add_fields_to_fieldset( - ['newsbox_published', + ['newsbox_status', 'newsbox_publication_start_date', 'newsbox_publication_end_date', ], fieldsets, - default_fieldset_name=_('Publication'), + default_fieldset_name=_('Publication settings'), default_fieldset_position=1) return fieldsets diff --git a/newsbox/locale/fr/LC_MESSAGES/django.mo b/newsbox/locale/fr/LC_MESSAGES/django.mo index f6262bb9e5657f5c178a292a064e2928ee2530d3..f5848f4f19e96b23214f106bf6c0cea9146c4a07 100644 Binary files a/newsbox/locale/fr/LC_MESSAGES/django.mo and b/newsbox/locale/fr/LC_MESSAGES/django.mo differ diff --git a/newsbox/locale/fr/LC_MESSAGES/django.po b/newsbox/locale/fr/LC_MESSAGES/django.po index ad819806a61cf4fc03cc4510e6c839d9db662300..e8dfe86f41c5d4197651f7cc8fbd98f5a7272e7c 100644 --- a/newsbox/locale/fr/LC_MESSAGES/django.po +++ b/newsbox/locale/fr/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-11-21 16:55+0100\n" -"PO-Revision-Date: 2016-11-21 16:59+0100\n" +"POT-Creation-Date: 2017-03-22 12:06+0100\n" +"PO-Revision-Date: 2017-03-22 12:11+0100\n" "Last-Translator: DylannCordel <d.cordel@webu.coop>\n" "Language-Team: Webu <developpeurs@webu.coop>\n" "Language: fr_FR\n" @@ -34,7 +34,7 @@ msgstr "Dépublier cette %s" msgid "Publish this %s" msgstr "Publier cette %s" -#: admin.py:143 models.py:190 +#: admin.py:143 models.py:216 msgid "published" msgstr "publiée" @@ -46,186 +46,352 @@ msgstr "date de pub." msgid "Title" msgstr "Titre" -#: admin.py:182 +#: admin.py:188 admin.py:221 admin.py:230 #, python-format msgid "You do not have permission to publish this %s" -msgstr "Vous n'avez pas la permission de publier cette %s" +msgstr "Vous n'avez pas la permission de publier ce %s" -#: admin.py:191 +#: admin.py:197 #, python-format -msgid "The %(objtype)s \"%(objtitle)s\" was successfully published" -msgstr "Cette %(objtype)s \"%(objtitle)s\" a été publiée avec succès" +msgid "publication status changed from %(old)s to %(new)s" +msgstr "statut de publication changé de %(old)s à %(new)s" -#: admin.py:201 +#: admin.py:202 #, python-format -msgid "The %(objtype)s \"%(objtitle)s\" was successfully unpublished" -msgstr "Cette %(objtype)s \"%(objtitle)s\" a été dépubliée avec succès" +msgid "The %(objtype)s \"%(objtitle)s\" has been successfully published" +msgstr "Le %(objtype)s \"%(objtitle)s\" a été publié avec succès" -#: admin.py:229 +#: admin.py:204 +#, python-format +msgid "The %(objtype)s \"%(objtitle)s\" has been successfully unpublished" +msgstr "Le %(objtype)s \"%(objtitle)s\" a été dépublié avec succès" + +#: admin.py:249 #, python-format msgid "You do not have permission to publish the %(objtype)s \"%(objtitle)s\"" msgstr "" -"Vous n'avez pas la permission de publier cette %(objtype)s \"%(objtitle)s\"" +"Vous n'avez pas la permission de publier ce %(objtype)s \"%(objtitle)s\"" + +#: admin.py:260 +msgid "Published" +msgstr "Publié" -#: admin.py:242 +#: admin.py:265 #, python-format -msgid "%(nb)d %(objtype)s was published" -msgid_plural "%(nb)d %(objtype)s were published" -msgstr[0] "%(nb)d %(objtype)s a été dépubliée avec succès" -msgstr[1] "%(nb)d %(objtype)s ont été dépubliées avec succès" +msgid "The %(objtype)s \"%(objtitle)s\" has been published" +msgstr "Le %(objtype)s \"%(objtitle)s\" a été publié avec succès" -#: admin.py:245 +#: admin.py:270 +#, python-format +msgid "%(nb)d %(objtype)s has been published" +msgid_plural "%(nb)d %(objtype)s have been published" +msgstr[0] "%(nb)d %(objtype)s a été publié avec succès" +msgstr[1] "%(nb)d %(objtype)s ont été publiés avec succès" + +#: admin.py:274 #, python-format msgid "Publish selected %(verbose_name_plural)s" -msgstr "Publier les %(verbose_name_plural)s sélectionnées" +msgstr "Publier les %(verbose_name_plural)s sélectionnés" -#: admin.py:260 +#: admin.py:290 #, python-format msgid "" "You do not have permission to unpublish the %(objtype)s \"%(objtitle)s\"" msgstr "" -"Vous n'avez pas la permission de dépublier cette %(objtype)s \"%(objtitle)s\"" +"Vous n'avez pas la permission de dépublier ce %(objtype)s \"%(objtitle)s\"" + +#: admin.py:301 +msgid "Unpublished" +msgstr "Dépublié" -#: admin.py:273 +#: admin.py:306 #, python-format -msgid "%(nb)d %(objtype)s was unpublished" -msgid_plural "%(nb)d %(objtype)s were unpublished" -msgstr[0] "%(nb)d %(objtype)s a été dépubliée avec succès" -msgstr[1] "%(nb)d %(objtype)s ont été dépubliées avec succès" +msgid "The %(objtype)s \"%(objtitle)s\" has been unpublished" +msgstr "Le %(objtype)s \"%(objtitle)s\" a été dépublié avec succès" -#: admin.py:281 +#: admin.py:311 +#, python-format +msgid "%(nb)d %(objtype)s has been unpublished" +msgid_plural "%(nb)d %(objtype)s have been unpublished" +msgstr[0] "%(nb)d %(objtype)s a été dépublié avec succès" +msgstr[1] "%(nb)d %(objtype)s ont été dépubliés avec succès" + +#: admin.py:315 #, python-format msgid "Unpublish selected %(verbose_name_plural)s" -msgstr "Dépublier les %(verbose_name_plural)s sélectionnées" +msgstr "Dépublier les %(verbose_name_plural)s sélectionnés" -#: admin.py:329 +#: admin.py:363 msgid "never" msgstr "jamais" -#: admin.py:338 +#: admin.py:372 #, python-format msgid "from %(from)s to %(to)s" msgstr "du %(from)s au %(to)s" -#: admin.py:339 +#: admin.py:373 msgid "to" msgstr "au" -#: admin.py:342 +#: admin.py:376 msgid "publication" msgstr "publication" -#: admin.py:354 -msgid "Publication" -msgstr "Publication" +#: admin.py:390 +msgid "Publication settings" +msgstr "Paramètres de publication" -#: admin.py:379 +#: admin.py:415 msgid "SEO Settings" msgstr "Options de référencement" -#: models.py:21 +#: models.py:24 msgid "title" msgstr "titre" -#: models.py:26 +#: models.py:25 +msgid "The title should not be too long and should be explicit" +msgstr "Le titre ne doit pas être trop long et doit être explicite" + +#: models.py:30 msgid "slug" msgstr "slug" -#: models.py:27 +#: models.py:31 msgid "The part of the title that is used in the URL" msgstr "La partie du titre utilisée dans l'URL" -#: models.py:31 +#: models.py:35 msgid "summary" msgstr "résumé" -#: models.py:35 +#: models.py:36 +msgid "This text must be short, it will be displayed in the lists." +msgstr "Ce texte doit être court, il sera utilisé dans les vue de listes." + +#: models.py:40 msgid "body" msgstr "corps" -#: models.py:42 +#: models.py:47 msgid "meta description" msgstr "méta description" -#: models.py:45 +#: models.py:49 +#, python-format +msgid "" +"The meta-description allow to improve your referencing and indicates to " +"search engines a summary of your page. To draft her better, you can consult " +"%(help_link)sthis help page%(link_end)s." +msgstr "" +"La méta-description permet d'améliorer votre référencement et indique aux " +"moteurs de recherche un résumé de votre page. Pour la renseigner au mieux, " +"vous pouvez consultez %(help_link)scette page d'aide%(link_end)s." + +#. Translators: This is the "help_link" URL for the meta-description help +#: models.py:54 +#, python-format +msgid "" +"%(start_tag)shttps://support.google.com/webmasters/answer/35624?" +"rd=1&hl=en#1%(end_tag)s" +msgstr "" +"%(start_tag)shttps://support.google.com/webmasters/answer/35624?" +"rd=1&hl=fr#1%(end_tag)s" + +#: models.py:62 msgid "meta keywords" msgstr "méta mots clés" -#: models.py:164 +#: models.py:63 +msgid "" +"List of few keywords (4-5) separated by commas. These words must be relevant " +"with the contents of your page : they must be present in the contents of the " +"page where they should be put in \"bold\" to highlight their importance. " +"Also try to place them in the title of your page. Note that even if Google " +"does not use this meta anymore, other search engines still use these, like " +"Yandex, the most used search engine in Russia." +msgstr "" +"Liste de quelques mots-clefs (4-5) séparés par des virgules. Ces mots " +"doivent être pertinents avec le contenu de votre page : ils doivent être " +"présents dans le contenu de la page où il devraient être mis en \"gras\" " +"pour souligner leur importance. Essayez également de les placer dans le " +"titre de votre page. Il est à noter que même si Google n'utilise plus cette " +"meta, d'autre moteur continue de l'utiliser, tel Yandex, le moteur de " +"recherche le plus utiliséen Russie." + +#: models.py:71 +msgid "canonical URL" +msgstr "URL canonique" + +#: models.py:73 +#, python-format +msgid "" +"This field allows you to indicate to search engines the \"official\" URL of " +"a duplicated contents. If your contents come from another page (of your " +"website or another one), then you should indicate the URL of the \"source\" " +"to avoid \"duplicated contents\" penalization of search engines. You can " +"consult %(help_link_1)sthe moz dossier%(end_link)s on this matter or " +"%(help_link_2)sGoogle help%(end_link)s." +msgstr "" +"Ce champ vous permet d'indiquer aux moteurs de recherche l'URL \"officielle" +"\" d'un contenu dupliqué. Si votre contenu provient d'une autre page (de " +"votre site ou non), alors vous devriez indiquer l'URL de ce contenu \"source" +"\" afin d'éviter que les moteurs de recherches ne vous pénalisent pour du " +"\"contenu dupliqué\". Vous pouvez consultez %(help_link_1)sle dossier de " +"webrankinfo%(end_link)s à ce sujet ou %(help_link_2)sl'aide google" +"%(end_link)s." + +#. Translators: This is the "help_link_1" URL for the canonical URL help +#: models.py:81 +#, python-format +msgid "" +"%(start_tag)shttps://moz.com/blog/canonical-url-tag-the-most-important-" +"advancement-in-seo-practices-since-sitemaps%(end_tag)s" +msgstr "" +"%(start_tag)shttp://www.webrankinfo.com/dossiers/techniques/url-canonique" +"%(end_tag)s" + +#. Translators: This is the "help_link_2" URL for the canonical URL help +#: models.py:87 +#, python-format +msgid "" +"%(start_tag)shttps://support.google.com/webmasters/answer/139066?" +"hl=en#2%(end_tag)s" +msgstr "" +"%(start_tag)shttps://support.google.com/webmasters/answer/139066?" +"hl=fr#2%(end_tag)s" + +#: models.py:215 +msgid "draft" +msgstr "brouillon" + +#: models.py:217 +msgid "archived" +msgstr "archivé" + +#: models.py:222 msgid "creation date" msgstr "date de création" -#: models.py:168 +#: models.py:226 msgid "last update date" msgstr "date de dernière modification" -#: models.py:174 -msgid "date" -msgstr "date" +#: models.py:232 +msgid "datetime" +msgstr "date-heure" -#: models.py:175 -msgid "Date of the event related to this news" -msgstr "Date de l'évènement lié à cette actualité" +#: models.py:233 +msgid "Datetime of the event related to this news" +msgstr "Date de l'évènement lié à ce billet" -#: models.py:182 +#: models.py:240 msgid "publication start date" msgstr "date de début de publication" -#: models.py:185 +#: models.py:243 msgid "" "When the news should go live. Status must be \"Published\" for news to go " "live." msgstr "" -"Date à laquelle l'actualité sera visible. Le statut doit être \"publié\" " -"pour que l'actualité soit visible." +"Date à laquelle le billet sera visible. Le statut doit être \"publié\" pour " +"que le billet soit visible." + +#: models.py:247 +msgid "status" +msgstr "statut" -#: models.py:199 models.py:200 +#: models.py:249 +msgid "" +"Use \"Draft\" to prepare your content before publishing and \"Archived\" to " +"unpublish content without deleting it" +msgstr "" +"Utilisez \"Brouillon\" pour préparer vos contenus avant publication et " +"\"Archivé\" pour dépublier un contenu sans le supprimer" + +#: models.py:257 models.py:258 msgid "news" -msgstr "actualité" +msgstr "billet" -#: models.py:204 +#: models.py:262 msgid "Can publish" msgstr "Peut publier" -#: models.py:262 +#: models.py:343 msgid "publication end date" msgstr "date de fin de publication" -#: models.py:265 -msgid "When to expire the news.Leave empty to never expire." +#: models.py:345 +msgid "When the news will expire. Leave empty to never expire." msgstr "" -"Date à laquelle l'actualité ne sera plus visible. Laisser vide pour qu'elle " +"Date à laquelle le billet ne sera plus visible. Laisser vide pour qu'elle " "n'expire jamais." -#: models.py:295 +#: models.py:384 msgid "indexed" -msgstr "indéxée" +msgstr "indéxé" -#: models.py:297 +#: models.py:386 +msgid "Not indexed on search engines" +msgstr "Ne pas indéxer sur les moteurs de recherche" + +#: models.py:387 +msgid "Indexed on search engines" +msgstr "Indexé sur les moteurs de recherche" + +#: models.py:388 msgid "An unindexed news will not be indexed by search engines." msgstr "" -"Une actualité non indéxée ne sera jamais indéxée par les moteurs de recherche" +"Un billet non indéxé ne sera jamais référencé par les moteurs de recherche" -#: templates/newsbox/list.html:41 -msgid "Read more" -msgstr "Lire la suite" +#: templates/newsbox/inc/detail.html:26 +#: templates/newsbox/inc/list_item.html:33 +#, python-format +msgid "published on %(date)s" +msgstr "publié le %(date)s" + +#: templates/newsbox/inc/list.html:23 templates/newsbox/inc/list.html.py:25 +msgid "All dates" +msgstr "Toutes les dates" + +#: templates/newsbox/inc/list.html:25 +msgid "Display all dates" +msgstr "Afficher toutes les dates" -#: templates/newsbox/list.html:56 +#: templates/newsbox/inc/list.html:27 +msgid "Display all months" +msgstr "Afficher tous les mois" + +#: templates/newsbox/inc/list.html:50 +msgid "Display all days" +msgstr "Afficher tous les jours" + +#: templates/newsbox/inc/list.html:72 msgid "Previous news" -msgstr "Actualités précédentes" +msgstr "Billets précédents" -#: templates/newsbox/list.html:60 +#: templates/newsbox/inc/list.html:76 #, python-format msgid "Page %(number)s on %(total)s" msgstr "Page %(number)s sur %(total)s" -#: templates/newsbox/list.html:64 +#: templates/newsbox/inc/list.html:80 msgid "Next news" -msgstr "Actualités suivantes" +msgstr "Billets suivants" -#: templates/newsbox/list.html:68 +#: templates/newsbox/inc/list.html:84 msgid "See all news" -msgstr "Voir toutes les actualités" +msgstr "Voir tous les billets" + +#: templates/newsbox/inc/list_item.html:36 +msgid "Read more" +msgstr "Lire la suite" + +#~ msgid "%(nb)d %(objtype)s was published" +#~ msgid_plural "%(nb)d %(objtype)s were published" +#~ msgstr[0] "%(nb)d %(objtype)s a été dépubliée avec succès" +#~ msgstr[1] "%(nb)d %(objtype)s ont été dépubliées avec succès" #~ msgid "Slug" #~ msgstr "Slug" @@ -274,9 +440,6 @@ msgstr "Voir toutes les actualités" #~ msgstr[0] "Affichage de toutes les actualités" #~ msgstr[1] "Affichage de toutes les actualités" -#~ msgid "Display of all news" -#~ msgstr "Affichage de toutes les actualités" - #~ msgid "" #~ "\n" #~ " Page %(number)s on %(total)s\n" diff --git a/newsbox/models.py b/newsbox/models.py index 6e6de8ee1840b5e9f65dbe5654ec531365d464d1..d3c5bce5cac4d17d9eb608014c5cccc8568b446a 100644 --- a/newsbox/models.py +++ b/newsbox/models.py @@ -11,7 +11,10 @@ from django.utils.timezone import now from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import python_2_unicode_compatible from django.utils import six +from django.utils.functional import lazy +from django.utils.safestring import mark_safe +mark_safe_lazy = lazy(mark_safe, six.text_type) newsbox_models = [] @@ -19,6 +22,7 @@ def newsbox_mcls_processor(mcls, class_name, class_bases, class_attrs, base, new if 'newsbox_title' not in class_attrs: class_attrs['newsbox_title'] = models.CharField( verbose_name=_('title'), + help_text=_('The title should not be too long and should be explicit'), max_length=255) newsbox_opts['trans_fieldnames'].append('newsbox_title') if 'newsbox_slug' not in class_attrs: @@ -28,7 +32,8 @@ def newsbox_mcls_processor(mcls, class_name, class_bases, class_attrs, base, new newsbox_opts['trans_fieldnames'].append('newsbox_slug') if 'newsbox_summary' not in class_attrs: class_attrs['newsbox_summary'] = models.TextField( - verbose_name=_('summary')) + verbose_name=_('summary'), + help_text=_('This text must be short, it will be displayed in the lists.')) newsbox_opts['trans_fieldnames'].append('newsbox_summary') if 'newsbox_body' not in class_attrs: class_attrs['newsbox_body'] = models.TextField( @@ -40,13 +45,55 @@ def newsbox_mcls_processor(mcls, class_name, class_bases, class_attrs, base, new def newsboxseo_mcls_processor(mcls, class_name, class_bases, class_attrs, base, newsbox_opts): class_attrs['newsbox_meta_description'] = models.TextField( verbose_name=_('meta description'), + help_text=mark_safe_lazy( + _('The meta-description allow to improve your referencing and indicates to ' + 'search engines a summary of your page. To draft her better, you can consult ' + '%(help_link)sthis help page%(link_end)s.') % { + 'help_link': _( + # Translators: This is the "help_link" URL for the meta-description help + '%(start_tag)s' + 'https://support.google.com/webmasters/answer/35624?rd=1&hl=en#1' + '%(end_tag)s') % {'start_tag': '<a target="_blank" href="', + 'end_tag': '">'}, + 'link_end': '</a>'} + ), max_length=255, blank=True, null=True) class_attrs['newsbox_meta_keywords'] = models.CharField( verbose_name=_('meta keywords'), + help_text=_('List of few keywords (4-5) separated by commas. These words must be relevant ' + 'with the contents of your page : they must be present in the contents of the ' + 'page where they should be put in \"bold\" to highlight their importance. ' + 'Also try to place them in the title of your page. Note that even if Google ' + 'does not use this meta anymore, other search engines still use these, like ' + 'Yandex, the most used search engine in Russia.'), max_length=255, blank=True, null=True) + class_attrs['newsbox_canonical_url'] = models.URLField( + verbose_name=_('canonical URL'), + help_text=mark_safe_lazy( + _('This field allows you to indicate to search engines the "official" URL of a ' + 'duplicated contents. If your contents come from another page (of your website ' + 'or another one), then you should indicate the URL of the "source" to avoid ' + '"duplicated contents" penalization of search engines. You can consult ' + '%(help_link_1)sthe moz dossier%(end_link)s on this matter or ' + '%(help_link_2)sGoogle help%(end_link)s.') % { + 'help_link_1': _( + # Translators: This is the "help_link_1" URL for the canonical URL help + '%(start_tag)s' + 'https://moz.com/blog/canonical-url-tag-the-most-important-advancement-in-seo-practices-since-sitemaps' # noqa + '%(end_tag)s') % {'start_tag': '<a target="_blank" href="', + 'end_tag': '">'}, + 'help_link_2': _( + # Translators: This is the "help_link_2" URL for the canonical URL help + '%(start_tag)s' + 'https://support.google.com/webmasters/answer/139066?hl=en#2' + '%(end_tag)s') % {'start_tag': '<a target="_blank" href="', + 'end_tag': '">'}, + 'end_link': '</a>'} + ), + null=True, blank=True,) newsbox_opts['trans_fieldnames'] += [ - 'newsbox_meta_description', 'newsbox_meta_keywords'] + 'newsbox_meta_description', 'newsbox_meta_keywords', 'newsbox_canonical_url'] ################################################################################################### @@ -161,6 +208,15 @@ class NewsboxBase(six.with_metaclass(NewsboxModelBase, models.Model)): Abstract class to build your own news """ + STATUS_DRAFT = 'draft' + STATUS_PUBLISHED = 'published' + STATUS_ARCHIVED = 'archived' + STATUS_CHOICES = ( + (STATUS_DRAFT, _('draft')), + (STATUS_PUBLISHED, _('published')), + (STATUS_ARCHIVED, _('archived')), + ) + # Automatic fields newsbox_creation_date = models.DateTimeField( verbose_name=_('creation date'), @@ -173,8 +229,8 @@ class NewsboxBase(six.with_metaclass(NewsboxModelBase, models.Model)): # event datetime newsbox_date = models.DateTimeField( - verbose_name=_('date'), - help_text=_('Date of the event related to this news'), + verbose_name=_('datetime'), + help_text=_('Datetime of the event related to this news'), default=None, db_index=False, null=True, blank=True, ) @@ -187,11 +243,11 @@ class NewsboxBase(six.with_metaclass(NewsboxModelBase, models.Model)): 'When the news should go live. ' 'Status must be "Published" for news to go live.'), null=False, blank=False) - - newsbox_published = models.BooleanField( - verbose_name=_('published'), - blank=True, - default=True,) + newsbox_status=models.CharField( + verbose_name=_('status'), max_length=10, + choices=STATUS_CHOICES, default=STATUS_DRAFT, + help_text=_('Use "Draft" to prepare your content before publishing and "Archived" to ' + 'unpublish content without deleting it')) default_manager = NewsboxManager() objects = default_manager @@ -209,7 +265,7 @@ class NewsboxBase(six.with_metaclass(NewsboxModelBase, models.Model)): @classmethod def q_published(cls): # Only published News - q = models.Q(newsbox_published=True) + q = models.Q(newsbox_status=cls.STATUS_PUBLISHED) # exclude news with publication start date in the future q &= models.Q(newsbox_publication_start_date__lte=now()) return q @@ -233,14 +289,14 @@ class NewsboxBase(six.with_metaclass(NewsboxModelBase, models.Model)): @property def is_published(self): - if not self.newsbox_published: + if self.newsbox_status != self.STATUS_PUBLISHED: return False return now() >= self.newsbox_publication_start_date def publish(self, commit=True): updated = False - if not self.newsbox_published: - self.newsbox_published = True + if self.newsbox_status != self.STATUS_PUBLISHED: + self.newsbox_status = self.STATUS_PUBLISHED updated = True if self.newsbox_publication_start_date: now_datetime = now() @@ -253,8 +309,8 @@ class NewsboxBase(six.with_metaclass(NewsboxModelBase, models.Model)): def unpublish(self, commit=True): updated = False - if self.newsbox_published: - self.newsbox_published = False + if self.newsbox_status == self.STATUS_PUBLISHED: + self.newsbox_status = self.STATUS_ARCHIVED updated = True if updated and commit: self.save() @@ -324,9 +380,11 @@ class NewsboxSEOBase(six.with_metaclass(NewsboxModelBase, models.Model)): """ # SEO Fields - newsbox_indexed = models.BooleanField( + newsbox_indexed = models.PositiveSmallIntegerField( verbose_name=_('indexed'), - default=True, + default=1, + choices=((0, _('Not indexed on search engines'), ), + (1, _('Indexed on search engines'), )), help_text=_('An unindexed news will not be indexed by search engines.')) class Meta: diff --git a/newsbox_cms/admin.py b/newsbox_cms/admin.py index e6b59b3e98d6b35abbc7a45d09fbd2d011e7fb62..cc6bf89999dce0d81cbe2ea12b48c6327cdebfa1 100644 --- a/newsbox_cms/admin.py +++ b/newsbox_cms/admin.py @@ -130,7 +130,8 @@ class NewsboxCMSAdmin( add_fields_to_fieldset( ['newsbox_summary'], fieldsets, - same_fieldset_as='newsbox_published', + same_fieldset_as='newsbox_title', + after_field='newsbox_date', replace_existing_field=True, remove_empty_fieldset=True, ) diff --git a/newsbox_cms/locale/fr/LC_MESSAGES/django.po b/newsbox_cms/locale/fr/LC_MESSAGES/django.po index bf780bfea1b1890e82af1e19621ac5eaaef428be..58eb30f363703223a6f95f7c4f6ef18dd158ab52 100644 --- a/newsbox_cms/locale/fr/LC_MESSAGES/django.po +++ b/newsbox_cms/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-11-21 16:56+0100\n" +"POT-Creation-Date: 2017-03-22 11:56+0100\n" "PO-Revision-Date: 2016-11-21 16:58+0100\n" "Last-Translator: DylannCordel <d.cordel@webu.coop>\n" "Language-Team: Webu <developpeurs@webu.coop>\n" @@ -32,11 +32,11 @@ msgstr "Afficher la page de l'objet" msgid "edit object's parameters" msgstr "Éditer les paramètres de l'objet" -#: cms_plugins.py:10 +#: cms_plugins.py:12 msgid "News list" msgstr "Liste d'actualités" -#: cms_plugins.py:23 +#: cms_plugins.py:47 msgid "The choosen news type to display is invalid" msgstr "Le type d'actualité à afficher choisi est invalide" @@ -88,7 +88,7 @@ msgstr[1] "Affichage de %(nb)d actualités" msgid "Display of all news" msgstr "Affichage de toutes les actualités" -#: templates/newsbox_cms/list-cms.html:13 +#: templates/newsbox_cms/inc/list_item.html:16 msgid "Read more" msgstr "Lire la suite" diff --git a/newsbox_i18n/locale/fr/LC_MESSAGES/django.po b/newsbox_i18n/locale/fr/LC_MESSAGES/django.po index b6864e351507eea7c7885dbc05261e9550c67208..b83a098baa0fc978ecc2ee2236599728e239d92e 100644 --- a/newsbox_i18n/locale/fr/LC_MESSAGES/django.po +++ b/newsbox_i18n/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-11-21 16:56+0100\n" +"POT-Creation-Date: 2017-03-22 11:56+0100\n" "PO-Revision-Date: 2016-11-21 16:57+0100\n" "Last-Translator: DylannCordel <d.cordel@webu.coop>\n" "Language-Team: Webu <developpeurs@webu.coop>\n" diff --git a/tests/myapp/README.md b/tests/myapp/README.md index 635d7799195e509b623cb97c955cd499464b8bca..4881eb205818d342a8f702732a668529781cd0d1 100644 --- a/tests/myapp/README.md +++ b/tests/myapp/README.md @@ -9,21 +9,21 @@ If not precised, news have those default values : * newsbox_title : News %(pk)d * newsbox_date : 2014-02-22 10:00:00 * newsbox_publication_start_date : 1985-07-02 10:00:00 -* newsbox_published : True +* newsbox_status : published * newsbox_summary : Summary of the news %(pk)d * newsbox_body : Body of the news %(pk)d ### List of all available test News -1. A basic classic published news -2. A not published news via newsbox_published - * newsbox_published = False +1. A basic classic published news +2. A not published news via newsbox_status + * newsbox_status = 'archived' 3. A not published news via newsbox_publication_start_date * newsbox_publication_start_date = 2020-01-01 10:00:00 4. A published news without body * newsbox_body = '' -5. A not published news via newsbox_published (same as #2) - * newsbox_published = False +5. A not published news via newsbox_status (same as #2) + * newsbox_status = 'archived' 6. A published news about an old event * newsbox_date = 2005-07-15 10:00:00 7. A published news about a future event @@ -31,7 +31,7 @@ If not precised, news have those default values : ## NewsExpired -If not precised, Expired news have default values from news for classic news +If not precised, Expired news have default values from news for classic news fields and those values for specific Expired news fields : * newsbox_publication_end_date : 2014-02-22 10:00:00 @@ -61,7 +61,7 @@ and those values for specific SEO news fields : ## NewsComplete -If not precised, Complete news have default values from news for classic news +If not precised, Complete news have default values from news for classic news fields, from NewsSEO for seo fields, from NewsExpired for expired fields. ### List of all available test NewsComplete @@ -72,8 +72,8 @@ fields, from NewsSEO for seo fields, from NewsExpired for expired fields. ## NewsExtended -If not precised, Complete news have default values from news for classic news -fields, from NewsSEO for seo fields, from NewsExpired for expired fields and +If not precised, Complete news have default values from news for classic news +fields, from NewsSEO for seo fields, from NewsExpired for expired fields and those values for specific NewsExtended news fields : * general_field : Test @@ -86,5 +86,5 @@ those values for specific NewsExtended news fields : ## Code used to generate test news -You can see the code used to generate initial fixtures in utils.py in this +You can see the code used to generate initial fixtures in utils.py in this directory. diff --git a/tests/myapp/migrations/0001_initial.py b/tests/myapp/migrations/0001_initial.py index 901e59bad64befb94161523df43e5c64ebad5292..5e334d357b907c8915e0278308a38b1e446ca6c2 100644 --- a/tests/myapp/migrations/0001_initial.py +++ b/tests/myapp/migrations/0001_initial.py @@ -19,7 +19,7 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ('newsbox_title', models.CharField(max_length=255, verbose_name='title')), ('newsbox_slug', models.SlugField(help_text='The part of the title that is used in the URL', verbose_name='slug')), ('newsbox_summary', models.TextField(verbose_name='summary')), @@ -39,15 +39,16 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ('newsbox_publication_end_date', models.DateTimeField(help_text='When to expire the news.Leave empty to never expire.', null=True, verbose_name='publication end date', db_index=True, blank=True)), - ('newsbox_indexed', models.BooleanField(default=True, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed')), + ('newsbox_indexed', models.PositiveSmallIntegerField(default=1, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed', choices=[(0, 'Not indexed on search engines'), (1, 'Indexed on search engines')])), ('newsbox_meta_description', models.TextField(max_length=255, null=True, verbose_name='meta description', blank=True)), ('newsbox_meta_keywords', models.CharField(max_length=255, null=True, verbose_name='meta keywords', blank=True)), ('newsbox_title', models.CharField(max_length=255, verbose_name='title')), ('newsbox_slug', models.SlugField(help_text='The part of the title that is used in the URL', verbose_name='slug')), ('newsbox_summary', models.TextField(verbose_name='summary')), ('newsbox_body', models.TextField(verbose_name='body', blank=True)), + ('newsbox_canonical_url', models.URLField(help_text='Ce champ vous permet d\'indiquer aux moteurs de recherche l\'URL "officielle" d\'un contenu dupliqu\xe9. Si votre contenu provient d\'une autre page (de votre site ou non), alors vous devriez indiquer l\'URL de ce contenu "source" afin d\'\xe9viter que les moteurs de recherches ne vous p\xe9nalisent pour du "contenu dupliqu\xe9". Vous pouvez consultez <a target="_blank" href="http://www.webrankinfo.com/dossiers/techniques/url-canonique">le dossier de webrankinfo</a> \xe0 ce sujet ou <a target="_blank" href="https://support.google.com/webmasters/answer/139066?hl=fr#2">l\'aide google</a>.', null=True, verbose_name='canonical URL', blank=True)), ], options={ 'ordering': ('-newsbox_publication_start_date',), @@ -63,7 +64,7 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ('newsbox_publication_end_date', models.DateTimeField(help_text='When to expire the news.Leave empty to never expire.', null=True, verbose_name='publication end date', db_index=True, blank=True)), ('newsbox_title', models.CharField(max_length=255, verbose_name='title')), ('newsbox_slug', models.SlugField(help_text='The part of the title that is used in the URL', verbose_name='slug')), @@ -84,9 +85,9 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ('newsbox_publication_end_date', models.DateTimeField(help_text='When to expire the news.Leave empty to never expire.', null=True, verbose_name='publication end date', db_index=True, blank=True)), - ('newsbox_indexed', models.BooleanField(default=True, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed')), + ('newsbox_indexed', models.PositiveSmallIntegerField(default=1, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed', choices=[(0, 'Not indexed on search engines'), (1, 'Indexed on search engines')])), ('general_field', models.CharField(max_length=50)), ('content_field', models.CharField(max_length=50)), ('seo_field', models.CharField(max_length=50)), @@ -96,6 +97,7 @@ class Migration(migrations.Migration): ('newsbox_slug', models.SlugField(help_text='The part of the title that is used in the URL', verbose_name='slug')), ('newsbox_summary', models.TextField(verbose_name='summary')), ('newsbox_body', models.TextField(verbose_name='body', blank=True)), + ('newsbox_canonical_url', models.URLField(help_text='Ce champ vous permet d\'indiquer aux moteurs de recherche l\'URL "officielle" d\'un contenu dupliqu\xe9. Si votre contenu provient d\'une autre page (de votre site ou non), alors vous devriez indiquer l\'URL de ce contenu "source" afin d\'\xe9viter que les moteurs de recherches ne vous p\xe9nalisent pour du "contenu dupliqu\xe9". Vous pouvez consultez <a target="_blank" href="http://www.webrankinfo.com/dossiers/techniques/url-canonique">le dossier de webrankinfo</a> \xe0 ce sujet ou <a target="_blank" href="https://support.google.com/webmasters/answer/139066?hl=fr#2">l\'aide google</a>.', null=True, verbose_name='canonical URL', blank=True)), ], options={ 'ordering': ('-newsbox_publication_start_date',), @@ -111,14 +113,15 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), - ('newsbox_indexed', models.BooleanField(default=True, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), + ('newsbox_indexed', models.PositiveSmallIntegerField(default=1, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed', choices=[(0, 'Not indexed on search engines'), (1, 'Indexed on search engines')])), ('newsbox_meta_description', models.TextField(max_length=255, null=True, verbose_name='meta description', blank=True)), ('newsbox_meta_keywords', models.CharField(max_length=255, null=True, verbose_name='meta keywords', blank=True)), ('newsbox_title', models.CharField(max_length=255, verbose_name='title')), ('newsbox_slug', models.SlugField(help_text='The part of the title that is used in the URL', verbose_name='slug')), ('newsbox_summary', models.TextField(verbose_name='summary')), ('newsbox_body', models.TextField(verbose_name='body', blank=True)), + ('newsbox_canonical_url', models.URLField(help_text='Ce champ vous permet d\'indiquer aux moteurs de recherche l\'URL "officielle" d\'un contenu dupliqu\xe9. Si votre contenu provient d\'une autre page (de votre site ou non), alors vous devriez indiquer l\'URL de ce contenu "source" afin d\'\xe9viter que les moteurs de recherches ne vous p\xe9nalisent pour du "contenu dupliqu\xe9". Vous pouvez consultez <a target="_blank" href="http://www.webrankinfo.com/dossiers/techniques/url-canonique">le dossier de webrankinfo</a> \xe0 ce sujet ou <a target="_blank" href="https://support.google.com/webmasters/answer/139066?hl=fr#2">l\'aide google</a>.', null=True, verbose_name='canonical URL', blank=True)), ], options={ 'ordering': ('-newsbox_publication_start_date',), diff --git a/tests/myapp/templates/myapp/inc/news_list_item.html b/tests/myapp/templates/myapp/inc/news_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp/templates/myapp/inc/news_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp/templates/myapp/inc/newscomplete_list_item.html b/tests/myapp/templates/myapp/inc/newscomplete_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp/templates/myapp/inc/newscomplete_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp/templates/myapp/inc/newsexpired_list_item.html b/tests/myapp/templates/myapp/inc/newsexpired_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp/templates/myapp/inc/newsexpired_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp/templates/myapp/inc/newsextended_list_item.html b/tests/myapp/templates/myapp/inc/newsextended_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp/templates/myapp/inc/newsextended_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp/templates/myapp/inc/newsseo_list_item.html b/tests/myapp/templates/myapp/inc/newsseo_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp/templates/myapp/inc/newsseo_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp/tests.py b/tests/myapp/tests.py index cf8707c501271962537f77fbfbeb0a9488d00b9a..d31ecbc9aa20b77f613acb1063ae97b31fc4af56 100644 --- a/tests/myapp/tests.py +++ b/tests/myapp/tests.py @@ -74,8 +74,8 @@ class NewsboxModelsTests(TestCase): def get_news_in_list_by_summary(self, response, summary): soup = BeautifulSoup(response.content, "html.parser") for news in soup.find_all('article'): - readmore_summary = news.find('p', text=summary) - if readmore_summary: + readmore_summary = news.find('div', attrs={'class': 'summary'}) + if readmore_summary and readmore_summary.text.strip() == summary: return news return None @@ -269,4 +269,3 @@ class NewsboxModelsTests(TestCase): # for model in [News, NewsSEO, NewsExpired, NewsComplete, NewsExtended]: # Permission.objects.filter(content_type__app_label='myapp', # content_type__model=model._meta.model_name) - \ No newline at end of file diff --git a/tests/myapp_all/migrations/0001_initial.py b/tests/myapp_all/migrations/0001_initial.py index 0e625b764629f0b0a17df097ba84be690234bcdb..cddfa827af0c1ecc315af4c27aaa64e98720c5dd 100644 --- a/tests/myapp_all/migrations/0001_initial.py +++ b/tests/myapp_all/migrations/0001_initial.py @@ -23,7 +23,7 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ('newsbox_body', cms.models.fields.PlaceholderField(slotname='newsbox_body', editable=False, to='cms.Placeholder', null=True, verbose_name='body')), ], options={ @@ -41,9 +41,9 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ('newsbox_publication_end_date', models.DateTimeField(help_text='When to expire the news.Leave empty to never expire.', null=True, verbose_name='publication end date', db_index=True, blank=True)), - ('newsbox_indexed', models.BooleanField(default=True, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed')), + ('newsbox_indexed', models.PositiveSmallIntegerField(default=1, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed', choices=[(0, 'Not indexed on search engines'), (1, 'Indexed on search engines')])), ('newsbox_body', cms.models.fields.PlaceholderField(slotname='newsbox_body', editable=False, to='cms.Placeholder', null=True, verbose_name='body')), ], options={ @@ -63,6 +63,7 @@ class Migration(migrations.Migration): ('newsbox_meta_keywords', models.CharField(max_length=255, null=True, verbose_name='meta keywords', blank=True)), ('newsbox_title', models.CharField(max_length=255, verbose_name='title')), ('newsbox_slug', models.SlugField(help_text='The part of the title that is used in the URL', verbose_name='slug')), + ('newsbox_canonical_url', models.URLField(help_text='Ce champ vous permet d\'indiquer aux moteurs de recherche l\'URL "officielle" d\'un contenu dupliqu\xe9. Si votre contenu provient d\'une autre page (de votre site ou non), alors vous devriez indiquer l\'URL de ce contenu "source" afin d\'\xe9viter que les moteurs de recherches ne vous p\xe9nalisent pour du "contenu dupliqu\xe9". Vous pouvez consultez <a target="_blank" href="http://www.webrankinfo.com/dossiers/techniques/url-canonique">le dossier de webrankinfo</a> \xe0 ce sujet ou <a target="_blank" href="https://support.google.com/webmasters/answer/139066?hl=fr#2">l\'aide google</a>.', null=True, verbose_name='canonical URL', blank=True)), ('master', models.ForeignKey(related_name='translations', editable=False, to='myapp_all.NewsComplete', null=True)), ], options={ @@ -82,9 +83,9 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ('newsbox_publication_end_date', models.DateTimeField(help_text='When to expire the news.Leave empty to never expire.', null=True, verbose_name='publication end date', db_index=True, blank=True)), - ('newsbox_indexed', models.BooleanField(default=True, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed')), + ('newsbox_indexed', models.PositiveSmallIntegerField(default=1, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed', choices=[(0, 'Not indexed on search engines'), (1, 'Indexed on search engines')])), ('general_field', models.CharField(max_length=50)), ('newsbox_body', cms.models.fields.PlaceholderField(slotname='newsbox_body', editable=False, to='cms.Placeholder', null=True, verbose_name='body')), ], @@ -107,6 +108,7 @@ class Migration(migrations.Migration): ('newsbox_meta_keywords', models.CharField(max_length=255, null=True, verbose_name='meta keywords', blank=True)), ('newsbox_title', models.CharField(max_length=255, verbose_name='title')), ('newsbox_slug', models.SlugField(help_text='The part of the title that is used in the URL', verbose_name='slug')), + ('newsbox_canonical_url', models.URLField(help_text='Ce champ vous permet d\'indiquer aux moteurs de recherche l\'URL "officielle" d\'un contenu dupliqu\xe9. Si votre contenu provient d\'une autre page (de votre site ou non), alors vous devriez indiquer l\'URL de ce contenu "source" afin d\'\xe9viter que les moteurs de recherches ne vous p\xe9nalisent pour du "contenu dupliqu\xe9". Vous pouvez consultez <a target="_blank" href="http://www.webrankinfo.com/dossiers/techniques/url-canonique">le dossier de webrankinfo</a> \xe0 ce sujet ou <a target="_blank" href="https://support.google.com/webmasters/answer/139066?hl=fr#2">l\'aide google</a>.', null=True, verbose_name='canonical URL', blank=True)), ('master', models.ForeignKey(related_name='translations', editable=False, to='myapp_all.NewsExtended', null=True)), ], options={ diff --git a/tests/myapp_all/templates/myapp_all/inc/news_list_item.html b/tests/myapp_all/templates/myapp_all/inc/news_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_all/templates/myapp_all/inc/news_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_all/templates/myapp_all/inc/newscomplete_list_item.html b/tests/myapp_all/templates/myapp_all/inc/newscomplete_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_all/templates/myapp_all/inc/newscomplete_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_all/templates/myapp_all/inc/newsexpired_list_item.html b/tests/myapp_all/templates/myapp_all/inc/newsexpired_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_all/templates/myapp_all/inc/newsexpired_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_all/templates/myapp_all/inc/newsextended_list_item.html b/tests/myapp_all/templates/myapp_all/inc/newsextended_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_all/templates/myapp_all/inc/newsextended_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_all/templates/myapp_all/inc/newsseo_list_item.html b/tests/myapp_all/templates/myapp_all/inc/newsseo_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_all/templates/myapp_all/inc/newsseo_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_cms/migrations/0001_initial.py b/tests/myapp_cms/migrations/0001_initial.py index ae21fc43077798aae038f3e26ab3a121e1009865..32ca51418436aacdf23d8233946c2ef2b58e9e63 100644 --- a/tests/myapp_cms/migrations/0001_initial.py +++ b/tests/myapp_cms/migrations/0001_initial.py @@ -22,7 +22,7 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ('newsbox_summary', djangocms_text_ckeditor.fields.HTMLField(verbose_name='summary')), ('newsbox_title', models.CharField(max_length=255, verbose_name='title')), ('newsbox_slug', models.SlugField(help_text='The part of the title that is used in the URL', verbose_name='slug')), @@ -42,15 +42,16 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ('newsbox_publication_end_date', models.DateTimeField(help_text='When to expire the news.Leave empty to never expire.', null=True, verbose_name='publication end date', db_index=True, blank=True)), - ('newsbox_indexed', models.BooleanField(default=True, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed')), + ('newsbox_indexed', models.PositiveSmallIntegerField(default=1, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed', choices=[(0, 'Not indexed on search engines'), (1, 'Indexed on search engines')])), ('newsbox_meta_description', models.TextField(max_length=255, null=True, verbose_name='meta description', blank=True)), ('newsbox_meta_keywords', models.CharField(max_length=255, null=True, verbose_name='meta keywords', blank=True)), ('newsbox_summary', djangocms_text_ckeditor.fields.HTMLField(verbose_name='summary')), ('newsbox_title', models.CharField(max_length=255, verbose_name='title')), ('newsbox_slug', models.SlugField(help_text='The part of the title that is used in the URL', verbose_name='slug')), ('newsbox_body', cms.models.fields.PlaceholderField(slotname='newsbox_body', editable=False, to='cms.Placeholder', null=True, verbose_name='body')), + ('newsbox_canonical_url', models.URLField(help_text='Ce champ vous permet d\'indiquer aux moteurs de recherche l\'URL "officielle" d\'un contenu dupliqu\xe9. Si votre contenu provient d\'une autre page (de votre site ou non), alors vous devriez indiquer l\'URL de ce contenu "source" afin d\'\xe9viter que les moteurs de recherches ne vous p\xe9nalisent pour du "contenu dupliqu\xe9". Vous pouvez consultez <a target="_blank" href="http://www.webrankinfo.com/dossiers/techniques/url-canonique">le dossier de webrankinfo</a> \xe0 ce sujet ou <a target="_blank" href="https://support.google.com/webmasters/answer/139066?hl=fr#2">l\'aide google</a>.', null=True, verbose_name='canonical URL', blank=True)), ], options={ 'ordering': ('-newsbox_publication_start_date',), @@ -66,9 +67,9 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ('newsbox_publication_end_date', models.DateTimeField(help_text='When to expire the news.Leave empty to never expire.', null=True, verbose_name='publication end date', db_index=True, blank=True)), - ('newsbox_indexed', models.BooleanField(default=True, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed')), + ('newsbox_indexed', models.PositiveSmallIntegerField(default=1, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed', choices=[(0, 'Not indexed on search engines'), (1, 'Indexed on search engines')])), ('general_field', models.CharField(max_length=50)), ('content_field', models.CharField(max_length=50)), ('seo_field', models.CharField(max_length=50)), @@ -78,6 +79,7 @@ class Migration(migrations.Migration): ('newsbox_title', models.CharField(max_length=255, verbose_name='title')), ('newsbox_slug', models.SlugField(help_text='The part of the title that is used in the URL', verbose_name='slug')), ('newsbox_body', cms.models.fields.PlaceholderField(slotname='newsbox_body', editable=False, to='cms.Placeholder', null=True, verbose_name='body')), + ('newsbox_canonical_url', models.URLField(help_text='Ce champ vous permet d\'indiquer aux moteurs de recherche l\'URL "officielle" d\'un contenu dupliqu\xe9. Si votre contenu provient d\'une autre page (de votre site ou non), alors vous devriez indiquer l\'URL de ce contenu "source" afin d\'\xe9viter que les moteurs de recherches ne vous p\xe9nalisent pour du "contenu dupliqu\xe9". Vous pouvez consultez <a target="_blank" href="http://www.webrankinfo.com/dossiers/techniques/url-canonique">le dossier de webrankinfo</a> \xe0 ce sujet ou <a target="_blank" href="https://support.google.com/webmasters/answer/139066?hl=fr#2">l\'aide google</a>.', null=True, verbose_name='canonical URL', blank=True)), ], options={ 'ordering': ('-newsbox_publication_start_date',), diff --git a/tests/myapp_cms/templates/myapp_cms/inc/news_list_item.html b/tests/myapp_cms/templates/myapp_cms/inc/news_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_cms/templates/myapp_cms/inc/news_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_cms/templates/myapp_cms/inc/newscomplete_list_item.html b/tests/myapp_cms/templates/myapp_cms/inc/newscomplete_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_cms/templates/myapp_cms/inc/newscomplete_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_cms/templates/myapp_cms/inc/newsexpired_list_item.html b/tests/myapp_cms/templates/myapp_cms/inc/newsexpired_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_cms/templates/myapp_cms/inc/newsexpired_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_cms/templates/myapp_cms/inc/newsextended_list_item.html b/tests/myapp_cms/templates/myapp_cms/inc/newsextended_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_cms/templates/myapp_cms/inc/newsextended_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_cms/templates/myapp_cms/inc/newsseo_list_item.html b/tests/myapp_cms/templates/myapp_cms/inc/newsseo_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_cms/templates/myapp_cms/inc/newsseo_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_i18n/migrations/0001_initial.py b/tests/myapp_i18n/migrations/0001_initial.py index b5b2ba198802e9067e1be43f6cef85ae40159560..d20f4771fc47f57cd1cb1f6fdcb06e12a195ff67 100644 --- a/tests/myapp_i18n/migrations/0001_initial.py +++ b/tests/myapp_i18n/migrations/0001_initial.py @@ -20,7 +20,7 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ], options={ 'ordering': ('-newsbox_publication_start_date',), @@ -37,9 +37,9 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ('newsbox_publication_end_date', models.DateTimeField(help_text='When to expire the news.Leave empty to never expire.', null=True, verbose_name='publication end date', db_index=True, blank=True)), - ('newsbox_indexed', models.BooleanField(default=True, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed')), + ('newsbox_indexed', models.PositiveSmallIntegerField(default=1, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed', choices=[(0, 'Not indexed on search engines'), (1, 'Indexed on search engines')])), ], options={ 'ordering': ('-newsbox_publication_start_date',), @@ -59,6 +59,7 @@ class Migration(migrations.Migration): ('newsbox_body', models.TextField(verbose_name='body', blank=True)), ('newsbox_meta_description', models.TextField(max_length=255, null=True, verbose_name='meta description', blank=True)), ('newsbox_meta_keywords', models.CharField(max_length=255, null=True, verbose_name='meta keywords', blank=True)), + ('newsbox_canonical_url', models.URLField(help_text='Ce champ vous permet d\'indiquer aux moteurs de recherche l\'URL "officielle" d\'un contenu dupliqu\xe9. Si votre contenu provient d\'une autre page (de votre site ou non), alors vous devriez indiquer l\'URL de ce contenu "source" afin d\'\xe9viter que les moteurs de recherches ne vous p\xe9nalisent pour du "contenu dupliqu\xe9". Vous pouvez consultez <a target="_blank" href="http://www.webrankinfo.com/dossiers/techniques/url-canonique">le dossier de webrankinfo</a> \xe0 ce sujet ou <a target="_blank" href="https://support.google.com/webmasters/answer/139066?hl=fr#2">l\'aide google</a>.', null=True, verbose_name='canonical URL', blank=True)), ('master', models.ForeignKey(related_name='translations', editable=False, to='myapp_i18n.NewsComplete', null=True)), ], options={ @@ -78,9 +79,9 @@ class Migration(migrations.Migration): ('newsbox_changed_date', models.DateTimeField(auto_now=True, verbose_name='last update date')), ('newsbox_date', models.DateTimeField(default=None, help_text='Date of the event related to this news', null=True, verbose_name='date', blank=True)), ('newsbox_publication_start_date', models.DateTimeField(default=datetime.datetime.now, help_text='When the news should go live. Status must be "Published" for news to go live.', verbose_name='publication start date', db_index=True)), - ('newsbox_published', models.BooleanField(default=True, verbose_name='published')), + ('newsbox_status', models.CharField(default='draft', help_text='Use "Draft" to prepare your content before publishing and "Archived" to unpublish content without deleting it', max_length=10, verbose_name='status', choices=[('draft', 'draft'), ('published', 'published'), ('archived', 'archived')])), ('newsbox_publication_end_date', models.DateTimeField(help_text='When to expire the news.Leave empty to never expire.', null=True, verbose_name='publication end date', db_index=True, blank=True)), - ('newsbox_indexed', models.BooleanField(default=True, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed')), + ('newsbox_indexed', models.PositiveSmallIntegerField(default=1, help_text='An unindexed news will not be indexed by search engines.', verbose_name='indexed', choices=[(0, 'Not indexed on search engines'), (1, 'Indexed on search engines')])), ('general_field', models.CharField(max_length=50)), ], options={ @@ -103,6 +104,7 @@ class Migration(migrations.Migration): ('newsbox_body', models.TextField(verbose_name='body', blank=True)), ('newsbox_meta_description', models.TextField(max_length=255, null=True, verbose_name='meta description', blank=True)), ('newsbox_meta_keywords', models.CharField(max_length=255, null=True, verbose_name='meta keywords', blank=True)), + ('newsbox_canonical_url', models.URLField(help_text='Ce champ vous permet d\'indiquer aux moteurs de recherche l\'URL "officielle" d\'un contenu dupliqu\xe9. Si votre contenu provient d\'une autre page (de votre site ou non), alors vous devriez indiquer l\'URL de ce contenu "source" afin d\'\xe9viter que les moteurs de recherches ne vous p\xe9nalisent pour du "contenu dupliqu\xe9". Vous pouvez consultez <a target="_blank" href="http://www.webrankinfo.com/dossiers/techniques/url-canonique">le dossier de webrankinfo</a> \xe0 ce sujet ou <a target="_blank" href="https://support.google.com/webmasters/answer/139066?hl=fr#2">l\'aide google</a>.', null=True, verbose_name='canonical URL', blank=True)), ('master', models.ForeignKey(related_name='translations', editable=False, to='myapp_i18n.NewsExtended', null=True)), ], options={ diff --git a/tests/myapp_i18n/templates/myapp_i18n/inc/news_list_item.html b/tests/myapp_i18n/templates/myapp_i18n/inc/news_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_i18n/templates/myapp_i18n/inc/news_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_i18n/templates/myapp_i18n/inc/newscomplete_list_item.html b/tests/myapp_i18n/templates/myapp_i18n/inc/newscomplete_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_i18n/templates/myapp_i18n/inc/newscomplete_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_i18n/templates/myapp_i18n/inc/newsexpired_list_item.html b/tests/myapp_i18n/templates/myapp_i18n/inc/newsexpired_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_i18n/templates/myapp_i18n/inc/newsexpired_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_i18n/templates/myapp_i18n/inc/newsextended_list_item.html b/tests/myapp_i18n/templates/myapp_i18n/inc/newsextended_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_i18n/templates/myapp_i18n/inc/newsextended_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/myapp_i18n/templates/myapp_i18n/inc/newsseo_list_item.html b/tests/myapp_i18n/templates/myapp_i18n/inc/newsseo_list_item.html new file mode 100644 index 0000000000000000000000000000000000000000..37db251b6a5c0d5db0c3d67b70e4c8df205c5451 --- /dev/null +++ b/tests/myapp_i18n/templates/myapp_i18n/inc/newsseo_list_item.html @@ -0,0 +1 @@ +{% extends 'newsbox/inc/list_item.html' %} diff --git a/tests/utils.py b/tests/utils.py index 74531c9216ccd2a2705f1df7c66a041446e2e417..b82027d1c42b02536be225fe55e143a6b5c7b14e 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -35,15 +35,15 @@ newsTypes = { 'newsbox_title': 'News %(i)d', 'newsbox_date': None, 'newsbox_publication_start_date': '2014-03-%(i)02dT10:00:00+02:00', - 'newsbox_published': True, + 'newsbox_status': 'published', 'newsbox_summary': 'Summary of the news %(i)d', 'newsbox_body': 'Body of the news %(i)d', }, 1: {}, - 2: {'newsbox_published': False}, + 2: {'newsbox_status': 'archived'}, 3: {'newsbox_publication_start_date': '2020-01-01T10:00:00+02:00'}, 4: {'newsbox_body': ''}, - 5: {'newsbox_published': False}, + 5: {'newsbox_status': 'archived'}, 6: {'newsbox_date': '2028-01-01T10:00:00+02:00', 'newsbox_publication_start_date': '2005-07-15T10:00:00+02:00'}, 7: {'newsbox_date': '1985-07-02T10:00:00+02:00'}, @@ -53,7 +53,7 @@ newsTypes = { 'overwrites': { 'inherit': ['myapp.News', ], 5: { - 'newsbox_published': True, + 'newsbox_status': 'published', 'newsbox_publication_end_date': '2014-06-01T10:00:00+02:00', }, },