Opened 16 years ago

Closed 16 years ago

#6185 closed (fixed)

FreeComment model breaks in admin

Reported by: Øyvind Saltvik <oyvind@…> 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)

r6898_comment_submit_date_fix.diff (695 bytes ) - added by Brian Rosner 16 years ago.
workaround to a legacy comments app problem
frecomment_removed_auto_add_now.diff (1.1 KB ) - added by Øyvind Saltvik <oyvind@…> 16 years ago.
auto add now sets editable=False removed it and set the submit_date in save
freecomments_newforms_fix.diff (767 bytes ) - added by aleander@… 16 years ago.
Fix as suggested

Download all attachments as: .zip

Change History (9)

comment:1 by Brian Rosner, 16 years ago

Keywords: nfa-blocker added
Triage Stage: UnreviewedAccepted

Just the copy and paste exception would have done ;) I have confirmed this. I will take a closer look a little later today.

comment:2 by Brian Rosner, 16 years ago

Keywords: freecomment model breaks admin removed

by Brian Rosner, 16 years ago

workaround to a legacy comments app problem

by Øyvind Saltvik <oyvind@…>, 16 years ago

auto add now sets editable=False removed it and set the submit_date in save

comment:3 by Øyvind Saltvik <oyvind@…>, 16 years ago

Has patch: set

comment:4 by Brian Rosner, 16 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.

by aleander@…, 16 years ago

Fix as suggested

comment:5 by aleander@…, 16 years ago

Well, this seems to work.

comment:6 by Brian Rosner, 16 years ago

Resolution: fixed
Status: newclosed

(In [7211]) newforms-admin: Fixed #6185. Removed submit_date from FreeComment ModelAdmin as it is not an editable field.

Note: See TracTickets for help on using tickets.
Back to Top