On Jun 13, 7:47 pm, Steve  Potter <[EMAIL PROTECTED]> wrote:
> I just updated the the latest version of Django and I started getting
> the following error in the admin interface:
>
> Caught an exception while rendering: invalid literal for int() with
> base 10: 'None'
>
> It seems to be the result of a model I have with a DateTimeField with
> both null and blank set to True, and a date_hierarchy set on the same
> field.
>
> Here is an example model that can re-produce the error:
>
> class Post(models.Model):
>         title = models.CharField(max_length=100)
>         publish_date = models.DateTimeField(null=True, blank=True)
>
>         def __unicode__(self):
>                 return unicode(self.title)
>
>         class Admin:
>                 date_hierarchy = 'publish_date'
>
> If I revert to a version of Django from before the qs-rf merge the
> error goes away.
>
> I have looked through the Backwards Incompatible changes and can't
> seem to find anything that would explain it.
>
> Is there some sort of work-around, or is this a bug?
>
> Thanks,
>
> Steven


I realized that I left a few things out when describing the problem.
The error occurs when trying to access the change_list portion of the
admin interface after a record has been inserted with a null date.

Here is more details on the error produced:


Template error

In template c:\python25\lib\site-packages\django\contrib\admin
\templates\admin\change_list.html, error at line 16
Caught an exception while rendering: invalid literal for int() with
base 10: 'None'
6       {% block coltype %}flex{% endblock %}
7       {% block content %}
8       <div id="content-main">
9       {% block object-tools %}
10      {% if has_add_permission %}
11      <ul class="object-tools"><li><a href="add/{% if is_popup %}?
_popup=1{% endif %}" class="addlink">{% blocktrans with
cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans
%}</a></li></ul>
12      {% endif %}
13      {% endblock %}
14      <div class="module{% if cl.has_filters %} filtered{% endif %}"
id="changelist">
15      {% block search %}{% search_form cl %}{% endblock %}
16      {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}
17      {% block filters %}{% filters cl %}{% endblock %}
18      {% block result_list %}{% result_list cl %}{% endblock %}
19      {% block pagination %}{% pagination cl %}{% endblock %}
20      </div>
21      </div>
22      {% endblock %}
23

So the error is a result of the null dated being processed by the
date_hierarchy tag.

Any ideas?

Thanks,

Steve
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to