Opened 18 years ago
Closed 18 years ago
#6185 closed (fixed)
FreeComment model breaks in admin
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | contrib.admin | Version: | newforms-admin | 
| Severity: | Keywords: | nfa-blocker | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
Traceback follows
Environment:
Request Method: GET
Request URL: http://emmet.cylon.no/admin/comments/freecomment/8/
Django Version: 0.97-newforms-admin-SVN-6914
Python Version: 2.4.3
Installed Applications: 
   ['emmet.conf',
 'emmet.emmetbase',
 'emmet.emmetpages',
 'emmet.emmetcontact',
 'emmet.emmettextileeditor',
 'emmet.emmetimages',
 'emmet.emmetregistration',
 'emmet.emmetgallery',
 'emmet.emmetfilearchive',
 'emmet.emmetnews',
 'tagging',
 'registration',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.humanize',
 'django.contrib.admin',
 'comment_utils',
 'django.contrib.comments',
 'eucaliptus',
 'extensions']
Installed Middleware: 
   ('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware')
Template error:
In template /home/emmet/code/django/contrib/admin/templates/admin/includes/fieldset.html, error at line 4
   Caught an exception while rendering: "Key 'submit_date' not found in Form"
   1 : <fieldset class="module aligned {{ fieldset.classes }}">
   2 :   {% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %}
   3 :   {% if fieldset.description %}<div class="description">{{ fieldset.description }}</div>{% endif %}
   4 :    {% for line in fieldset %} 
   5 :       <div class="form-row{% if line.errors %} errors{% endif %} {% for field in line %}{{ field.field.name }} {% endfor %} ">
   6 :       {{ line.errors }}
   7 :       {% for field in line %}
   8 :           {% if field.is_checkbox %}
   9 :               {{ field.field }}{{ field.label_tag }}
   10 :           {% else %}
   11 :               {{ field.label_tag }}{{ field.field }}
   12 :           {% endif %}
   13 :           {% if field.field.field.help_text %}<p class="help">{{ field.field.field.help_text|safe }}</p>{% endif %}
   14 :       {% endfor %}
Traceback:
File "/home/emmet/code/django/template/__init__.py" in render_node
  822.             result = node.render(context)
File "/home/emmet/code/django/template/defaulttags.py" in render
  151.                 nodelist.append(node.render(context))
File "/home/emmet/code/django/template/defaulttags.py" in render
  241.                     value = bool_expr.resolve(context, True)
File "/home/emmet/code/django/template/__init__.py" in resolve
  579.             obj = self.var.resolve(context)
File "/home/emmet/code/django/template/__init__.py" in resolve
  720.             value = self._resolve_lookup(context)
File "/home/emmet/code/django/template/__init__.py" in _resolve_lookup
  755.                                 current = current()
File "/home/emmet/code/django/contrib/admin/options.py" in errors
  104.         return mark_safe(u'\n'.join([self.form[f].errors.as_ul() for f in self.fields]))
File "/home/emmet/code/django/newforms/forms.py" in __getitem__
  85.             raise KeyError('Key %r not found in Form' % name)
Exception Type: KeyError at /admin/comments/freecomment/8/
Exception Value: "Key 'submit_date' not found in Form"
      Attachments (3)
Change History (9)
comment:1 by , 18 years ago
| Keywords: | nfa-blocker added | 
|---|---|
| Triage Stage: | Unreviewed → Accepted | 
comment:2 by , 18 years ago
| Keywords: | freecomment model breaks admin removed | 
|---|
by , 18 years ago
| Attachment: | r6898_comment_submit_date_fix.diff added | 
|---|
workaround to a legacy comments app problem
by , 18 years ago
| Attachment: | frecomment_removed_auto_add_now.diff added | 
|---|
auto add now sets editable=False removed it and set the submit_date in save
comment:3 by , 18 years ago
| Has patch: | set | 
|---|
comment:4 by , 18 years ago
Øyvind,
Your patch is correcting the right problem, but it would be a better patch to just use default=datetime.datetime.now instead of overriding the save method.
comment:6 by , 18 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
  Note:
 See   TracTickets
 for help on using tickets.
    
Just the copy and paste exception would have done ;) I have confirmed this. I will take a closer look a little later today.