Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

duplicate pages in the teaser plugin #343

Closed
yml opened this Issue Feb 2, 2010 · 3 comments

Comments

Projects
None yet
3 participants
Contributor

yml commented Feb 2, 2010

After a fruitful discussion on #django-cms with stefanfoulis and ojii we come to the conclusion that the pages are not exactly duplicated but in fact the pages is shown in its 2 states published and draft.

So this duplication can be solved in at least 2 different ways : by restricting the selection to the published Pages :

------------8<--------------------------------
diff --git a/cms/plugins/teaser/models.py b/cms/plugins/teaser/models.py
index c99150d..6bd7807 100644
--- a/cms/plugins/teaser/models.py
+++ b/cms/plugins/teaser/models.py
@@ -10,7 +10,10 @@ class Teaser(CMSPlugin):
"""
title = models.CharField(("title"), max_length=255)
image = models.ImageField(
("image"), upload_to=CMSPlugin.get_media_path, bla

  • page_link = models.ForeignKey(Page, verbose_name=("page"), help_text=("If p
  • page_link = models.ForeignKey(Page,
  •                              limit_choices_to={'publisher_is_draft':True}, #Not clear why this need to be true
    
  •                              verbose_name=_("page"),
    
  •                              help_text=_("If present image will be clickable
    
    url = models.CharField(("link"), max_length=255, blank=True, null=True, help
    description = models.TextField(
    ("description"), blank=True, null=True)
    ------------8<--------------------------------

or by changing the unicode method to display the state of the Page this will avoid some confusion.

Regards,
--yml

Collaborator

ojii commented Feb 2, 2010

here's the diff a bit more readable: http://gist.github.com/292515

Me and stefan have look at this together with yml yesterday.

Contributor

yml commented Feb 2, 2010

Ojii,
Your proposal is sligtly different than mine, I am suggesting :

  • limit_choices_to={'publisher_is_draft':True},

I don't know why True is the "good" value because it seems a bit anti natural but I have observed that with False the hyperlink to the page does not get displayed on the published page.
Regards,
--yml

Member

digi604 commented Mar 12, 2010

closed by 88701f4, teaser links only draft pages

@christianbertschy christianbertschy pushed a commit to christianbertschy/django-cms-2.0 that referenced this issue Oct 1, 2012

@digi604 digi604 fixes #343, teaser links only draft pages 88701f4

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment