Browse model UserProfile -> ManyToManyField -> (OneToOneField -> Item)

Diego Uribe Gamez diego.uribe.gamez at gmail.com
Thu May 17 19:21:40 EDT 2012


The problem is I can not navigate this model who believes has in particular
that the user assigned to some entries, the model is using ManyToManyField
to another model and this model by entering a OneToOneField assigned to
another model.
Model - a model ManyToManyField - until the last OneToOneField model and
data.
I need the data.
the idea is to get all data from all entries, please see the example:
---------------------------------------------------------------------------------------------------
class User
 # a standard django.contrib.auth user model
class UserProfile(models.Model):
 # my AUTH_PROFILE_MODULE for django-profiles
 user = models.ForeignKey(User, unique=True)
 instance = models.ManyToManyField(Instance1)
class Instance1(models.Model):
 user = models.ForeignKey(User)
 element1 = models.CharField(max_length=12)
 instance2 = models.OneToOneField(Instance2)
element1 = 'letter%s' % (X)
class Instance2(models.Model):
 element2 = models.CharField(max_length=12)
element2 = 'number%s' % (X)
X = X + 1
user = request.user
Instance1 - element1
 - letter1
 - letter2
 - letter3
Instance2 - element2
 - number1
 - number2
 - number3
as I can get the letters and all numbers using profile and placed in a
variable to render in the template all the ManyToManyField ->
(OneToOneField -> Items) ?
-- 
 *Diego Alonso Uribe Gamez*
------------------------------
*Desarrollador web*
Twitter: @DiegoUG <http://www.twitter.com/DiegoUG>
Google+: http://gplus.to/diegoug
------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120517/87a8b4a2/attachment.html>


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /