Hi,

I've a problem with the Django admininterface on my productive server.
If I want add an object with the admininterface I get following error
message:

KeyError at /admin/catalog/artikel/add/
<type 'instance'>
Request Method:         GET
Request URL:    --MYSERVER--/admin/catalog/artikel/add/
Exception Type:         KeyError
Exception Value:        <type 'instance'>
Exception Location:     /usr/lib/python2.4/site-packages/django/utils/
functional.py in __wrapper__, line 43
Template error

In template /usr/lib/python2.4/site-packages/django/contrib/admin/
templates/admin/field_line.html, error at line 4
Caught an exception while rendering: <type 'instance'>
1       {% load admin_modify %}
2       <div class="{{ class_names }}" >
3       {% for bound_field in bound_fields %}
{{ bound_field.html_error_list }}{% endfor %}
4       {% for bound_field in bound_fields %}
5       {% if bound_field.has_label_first %}{% field_label bound_field %}{%
endif %}
6       {% field_widget bound_field %}
7       {% if not bound_field.has_label_first %}{% field_label bound_field
%}{% endif %}
8       {% if bound_field.field.help_text %}<p
class="help">{{ bound_field.field.help_text }}</p>{% endif %}
9       {% endfor %}
10      </div>
11
Traceback (innermost last)
Switch to copy-and-paste view

    * /usr/lib/python2.4/site-packages/django/template/__init__.py in
render_node
       741. result = node.render(context) ...
    * /usr/lib/python2.4/site-packages/django/template/defaulttags.py
in render
       125. nodelist.append(node.render(context)) ...
    * /usr/lib/python2.4/site-packages/django/template/defaulttags.py
in render
       211. if (value and not ifnot) or (ifnot and not value): ...
     * /usr/lib/python2.4/site-packages/django/utils/functional.py in
__wrapper__
        43. return self.__dispatch[type(res)][funcname](res, *args,
**kw) ...


I only get this message on my productive server. It runs with
mod_python, postgresql 8.1 and Django SVN Revison 5335.
The same revision is on my local pc. But I use postgresql 8.2 and
djangos internal server. On my local pc I don't get any errors.

My model looks like the following:

class Marke(models.Model):
        name = models.CharField(maxlength=100)
        bild = models.ImageField(upload_to='marken/', height_field='hoehe',
width_field='breite', blank = True, null=True)

class Optionen(models.Model):
        name    = models.CharField(maxlength=100)

class Optionswert(models.Model):
        name    = models.CharField(maxlength=100, core=True)
        option  = models.ForeignKey(Optionen, edit_inline=models.TABULAR,
num_in_admin=7, num_extra_on_change=4,)

class Rubrik(models.Model):
        name    = models.CharField(maxlength=100)
        rubrik  = models.ForeignKey('self', blank=True, null=True,
related_name="Elternrubrik")
        bild = models.ImageField(upload_to='rubrik/', height_field='hoehe',
width_field='breite', blank = True, null=True)

class Artikel(models.Model):
        MWST = (
                (7 , 'Ermäßigt' ),
                (19, 'normal'),
        )
        art_name = models.CharField(maxlength=100)
        kurztext = models.CharField(maxlength=500)
        beschreibung = models.TextField()
        preis   = models.FloatField()
        mwst    = models.IntegerField(choices=MWST)
        optionen = models.ManyToManyField(Optionswert)
        anzahl  = models.IntegerField(blank=True, null=True)
        rubrik  = models.ForeignKey(Rubrik)
        marke   = models.ForeignKey(Marke)

        def __str__(self):
                return self.art_name

        class Admin:
                list_display=('art_name', 'rubrik', 'marke', 'preis')
                list_filter=['marke', 'rubrik']


I got a similar message when I try to change users with
django.contrib.auth and again only on the server.
Create or change objects without the admin works fine. So I think its
a problem with the admin. But I don't know why I only have these bug
on the server and not local.
The error message is in these case:

KeyError at /admin/auth/user/1/
<type 'instance'>
Request Method:         GET
Request URL:    --MYSERVER--/admin/auth/user/1/
Exception Type:         KeyError
Exception Value:        <type 'instance'>
Exception Location:     /usr/lib/python2.4/site-packages/django/utils/
functional.py in __wrapper__, line 43
Template error

In template /usr/lib/python2.4/site-packages/django/contrib/admin/
templates/admin/field_line.html, error at line 4

Ohh, i see that there is another different between server and my local
computer. I use python2.4 on serverside and 2.5 on my local
computer....

Hope you can help me....

Christian!


--~--~---------~--~----~------------~-------~--~----~
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