>     ds = DigitalSignage.objects.get(pk=ds_id)                 
> #Digital Signage config & setting
>     setting = ds.setting
>     textslots = ds.textslot_set.all()
>     slots = ds.slot_set.all()
>     tableslots = tableSlot.objects.filter(DS_List=ds)
>     columnsetups = columnSetup.objects.filter(tableList=tableslots)
>     querysetups = querySetup.objects.filter(tableList=tableslots)
>
> but bumps into another problems.. really headache when i call the  
> columnsetups or querysetups it will gave me error
>
>         {%for tableslots in tableslots_list%}
>             <text> {{tableslots.Transparency}} </text>
>         {%endfor%}
>         {%for querysetups in querysetups_list%}
>             {{querysetups.dbTemp}} </text>
>         {%endfor%}
>
> Request Method:
> GET
> Request URL:
> http://localhost/reed/1/ds.xml
> Exception Type:
> InterfaceError
> Exception Value:
> Error binding parameter 0 - probably unsupported type.
> Exception Location:
> C:\Python25\lib\site-packages\django\db\backends\sqlite3\base.py in  
> execute, line 133
> Python Executable:
> C:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe
> Python Version: 2.5.1

Bit of blank guessing from the error message, but there may just be  
some awkward/exotic field in one of your models that sqlite cannot  
handle; or it's a genuine Django backend bug. What do your model  
definitions look like for columnSetup and querySetup?


>
> > thanks for reply, but i don't quite understand :( sorry i'm newbie
> > here....
> > First my models.py is like this
> > class DigitalSignage(models.Model):
> >    DS_ID = integerField()
> >
> > class tableSlot(models.Model):
> >    ds_id =models.ManyToManyField(DigitalSignage)
> >
> > class columnSetup(models.Model):
> >        tableList          =models.ManyToManyField(tableSlot)
> >
> > so in my views.py like this:
>
>
> >
> > >    ds = DigitalSignage.objects.get(pk=ds_id)
>
> Here, you are retrieving a single object, namely a DigitalSignage (as
> defined in your model).
> The <m2m-relation>_set identifier will work for objects, as below.
>
>
> > >    tableslots = ds.tableslot_set.all()
>
> Here, you're retrieving all tableslots, which results in a QuerySet.
> It is a QuerySet of your tableSlot model, but it's not the model
> itself. A QuerySet allows filtering, but you cannot directly retrieve
> any of the relations defined in your models, since it's not the model
> itself.
> Have another look at 
> http://www.djangoproject.com/documentation/db-api/#many-to-many-relationships
> You'll see that the <m2m-relation>_set is used for an object, not a
> QuerySet.
>
>
> >
> > >    columnsetups = tableslots.columnsetup_set.all()
> >
> > so now if i change upwards... that's mean my models.py should be
> > like this:
> > class DigitalSignage(models.Model):
> >    DS_ID = integerField()
> >
> > class columnSetup(models.Model):
> >    field1 = models.charField()
> >
> > class tableSlot(models.Model):
> >    ds_id =models.ManyToManyField(DigitalSignage)
> >    columnList          =models.ManyToManyField(columnSetup)
>
> Changing your models has nothing to do with it.
>
> Therefore, continuing with the model defintion you originally had (top
> of this mail), you should probably access things from the other side:
> ds = DigitalSignage.objects.get(pk=ds_id)
> tableslots = tableSlot.objects.filter(ds_id=ds)  # note: not using
> ds.id. See also note below
>
> Also, have another good luck at 
> http://www.djangoproject.com/documentation/db-api/#lookups-that-span-relationships
>
>
> Lastly, I can suggest some renaming, to stay with the usage in Python
> and Django. Has nothing to do with the problem, so consider it free
> (and possibly unwanted) advice:
> - model names start with a Capital (TableSlot instead of tableSlot);
> as you do for DigitalSignage.
> - m2m relations are often named as the plural of the relation they
> refer to. So ds_id should become something like digital_signages (or
> signages, if you consider that too long). In particular, the ds_id
> naming is rather badly chosen, since it should reflect an object, not
> the database id of that object (don't think database-level, think
> object-level). It is indeed an id (integer) in the database, but if
> you would retrieve if from your model (through a_table_slot.ds_id),
> it'll show up as a DigitalSignage object, not a number.
>
> Good luck.
>
>
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  
> Try it now.
> >


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