Note that there are some explanatory texts on larger screens.

plurals
  1. PO'unicode' object has no attribute 'date'
    text
    copied!<p>I have got this kind of code:</p> <p><em>models.py</em>:</p> <pre><code>from django.db import models import ioweyou.settings as settings from comment.models import Comment class Entry(models.Model): OPEN = 0 ACCEPTED = 1 REJECTED = 2 DELETED = 3 STATUS_CHOICES = ( (OPEN, 'Open'), (ACCEPTED, 'Accepted'), (REJECTED, 'Rejected'), (DELETED, 'Deleted'), ) name = models.CharField(max_length=255) description = models.TextField('entry description', blank=True, null=True) value = models.DecimalField(max_digits=6, decimal_places=2) lender = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, related_name='lender') debtor = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, related_name='debtor') status = models.SmallIntegerField(default=0, choices=STATUS_CHOICES) accepted_at = models.DateTimeField(blank=True, null=True) rejected_at = models.DateTimeField(blank=True, null=True) created_at = models.DateTimeField(auto_now_add=True, editable=False) updated_at = models.DateTimeField(auto_now=True) def __unicode__(self): return self.name class EntryComment(Comment): entry = models.ForeignKey(Entry, null=False, related_name="comments") </code></pre> <p><em>admin.py</em></p> <pre><code>class EntryAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['name']}), ('Date information', {'fields': ['accepted_at']}), ] admin.site.register(models.Entry, EntryAdmin) </code></pre> <p>and this kind of error:</p> <pre><code>AttributeError at /admin/entry/entry/116/ 'unicode' object has no attribute 'date' Error during template rendering In template /Library/Python/2.7/site-packages/django/contrib/admin/templates/admin/includes/fieldset.html, error at line 19 </code></pre> <p>django and python have been dealing with recently. And my knowledge is not complete. Is anyone able to help me?</p> <p>Error occurs when you try to edit the Entry and the value of the field accepted_at is determined (set already).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload