I forgot to add :
I'm running django-trunk, so it might be related to the queryset
refactoring merge ?
2008/5/1 Guillaume Lederrey <[EMAIL PROTECTED]>:
> Hello !
>
> I am getting a strange query from the archive_index generic view :
>
> SELECT DISTINCT CAST(DATE_FORMAT(`news_news`.`publication_date`,
> '%Y-01-01 00:00:00') AS DATETIME) FROM `news_news` WHERE
> `news_news`.`publication_date` IS NULL ORDER BY 1 ASC
>
> I dont understand where the "IS NULL" comes from. As all the news in
> my database have a publication_date, this query returns nothing and no
> news is displayed.
>
> Any help appreciated !
>
> Here is my ulrs.py :
>
> urlpatterns = patterns('',
> url(r'^$',
> date_based.archive_index,
> {
> 'queryset' : News.objects.all(),
> 'date_field' : 'publication_date',
> 'allow_future' : True,
> },
> ),
> )
>
>
> and the model :
>
> class News(models.Model):
> """ News model """
> title = models.CharField(max_length=100, unique=True)
> slug = models.SlugField(prepopulate_from=("title",),
> unique_for_date='publication_date')
> author = models.ForeignKey(User)
> creation_date = models.DateField(auto_now_add=True)
> modification_date = models.DateField(auto_now=True)
> publication_date = models.DateField(blank=True, null=True)
> ask_promotion = models.BooleanField(default=False,
> help_text=_("Ask for this news
> to be promoted on the front page. For example, an artist might be able
> to write news for its next gig, and have the news appear on the
> artist's page, but not on the front page. The artist can ask a
> moderator to promote the news on the front page by checking this
> field."))
> promoted = models.BooleanField(default=False,
> help_text=_("If this field is
> checked, the news will appear on the front page."))
> trock_news = models.BooleanField(default=False,
> help_text=_("Check this field if
> you want this news to be published in the next TrocK news."))
> text = models.TextField(blank=True)
>
> class Meta:
> """
> Defines meta data on the model.
> """
> verbose_name_plural = _('news')
> ordering = ['-publication_date', 'title',]
> permissions = (
> ("export_trock_news", _("Can export the list of news
> selected for the next TrocK news")),
> )
>
> class Admin:
> """
> This model is available in the admin interface.
> """
> list_display = ('title', 'publication_date',)
>
> def __unicode__(self):
> return '%s' % self.title
>
> @permalink
> def get_absolute_url(self):
> """
> The URL to this news in the date based view.
> """
> return ('news_detail', (), {
> 'year' : self.publication_date.year,
> 'month' : self.publication_date.month,
> 'day' : self.publication_date.day,
> 'slug' : self.slug,
> })
>
> @permalink
> def get_absolute_url_by_id(self):
> """
> The URL to this news in the ID based view.
> """
> return ('news_detail_by_id', (), {
> 'object_id' : self.pk,
> })
>
>
>
> --
> Jabber : [EMAIL PROTECTED]
> Skype : Guillaume.Lederrey
> Projects :
> * http://rwanda.ledcom.ch/
>
--
Jabber : [EMAIL PROTECTED]
Skype : Guillaume.Lederrey
Projects :
* http://rwanda.ledcom.ch/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---