I'm new to Django, and have played with Python for a few years on and off (not a real programmer). I'm keen to use Django to explore some data because of its custom data models which I plan to rely on extensively (putting the complex code there).
Try as I might, I can't see how to get them to work. I can get the fields from the database to display in the html created by the render_to_response() function, but the custom fields do not compute and display. They come out empty. I'm also struggling how to get access to the data inside of Python to enable data handling by other Python code. For example, when I issue a "print mvalues[0]" in the example below, I get all the fields for the first record of the database returned, but I don't the custome fields, which I expected. My guess is I have to some other code format, but I don't see examples for this in "The Definitive Guide to django" by Holovaty and Kaplan- Moss. Example: The data model- class Tmeetings(models.Model): Date = models.DateTimeField(null=True, blank=True) Speaker = models.CharField(blank=True, max_length=150) Venue = models.CharField(blank=True, max_length=150) Cost = models.FloatField(null=True, blank=True) def __str__(self): return '%s, %s' % (self.Date, self.Speaker) def test (self): return self.Speaker+self.Venue class Meta: db_table = 'tmeetings' class Admin: pass Example: The test template file mtg_summary.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:// www.w3.org/TR/html4/loose.dtd"> <html><head><title>{{ meeting_title }} </title><meta http- equiv="Content-Type" content="text/html; charset=iso-8859-1" ></head> <body> <p>template: mtg_summary.html</p> <p>Talk_title: {{ Talk_Title }}</p> <p>Speaker: {{ Speaker }}</p> <p>Speaker_Title:{{ Speaker_title }}</p> <p>test: {{ test }}</p> </body></html> Example: The Problem (code snippet) >>>from django.shortcuts import render_to_response >>>from soc.models import Tmeeting >>>m_values=Members.objects.values() >>> print render_to_response('mtg_summary.html',mvalues[0]) Content-Type: text/html; charset=utf-8 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:// www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" > </head> <body> <p>template: mtg_summamry.html</p> <p>Talk_title: None</p> <p>Speaker: George Smith</p> <p>Speaker_Title: Title of the test record</p> <p>test: </p> </body> </html> >>> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---