Hi all

A while ago I had a problem as described below. I found the solution so am 
posting it 
here in case others have the same prob in future.

The "Error: variable not passed into template?" was appearing where the 
headings for 
the table showing the contents of the Data model should have been - but there 
were no 
headings. So it was the headings i.e. the field names of the model that were 
not 
being passed into the template.
(The text of "Error: variable not passed into template?" comes from 
TEMPLATE_STRING_IF_INVALID in my settings file.)

Notice in my Class I had experiment_id and node_id, particularly they have _id 
at the 
end. This is what caused the problem. If instead of this:
   Class Admin:
       pass

I have:

   Class Admin:
       list_display('id', 'experiment_id', 'node_id', 'content')

Then in admin the Data table show the correct headings and there is no errors.
     ID  Experiment id   Node id   Content

Hence it appears that in a model that if one has fields with _id in their name 
there 
are problems.

Michael Lake wrote:
> Hi all
> 
> In the Admin interface I'm getting the folloing error for a model:
>     Error: variable not passed into template?>Data
> 
> class Data(models.Model):
>       experiment_id = models.CharField(maxlength=10)
>       node_id       = models.CharField(maxlength=10)
>       content = models.TextField(blank=True)
> 
>       class Meta:
>               verbose_name_plural = 'Data'
> 
>       class Admin:
>               pass
> 
> The Admin interface is not showing the columns of the table but just a list 
> like this:
>       Data object
>       Data object ...
> 
> I can add a row or delete a row and I can edit the rows using the admin 
> interface.
> I can't see whats wrong with this particular model.
> manage syncdb runs with no errors and manage.py validate says 0 errors.
> In models.py the other models display fine in the Admin interface.
> 
> Mike


-- 
Michael Lake
Computational Research Support Unit
Science Faculty, UTS
Ph: 9514 2238




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