Dear all,

I am really struggling with pulling information out of a class object. I 
have tried doing this with FK field, proxy models (shown below as I feel 
this is the closest to working), etc. and cannot get it to work. I cannot 
pull the information from my database. I would greatly appreciate help. 
What I want is to have access to all of these fields independently. I feel 
like what I have should work but I cannot get the information out of my 
proxy models (shown below). I see what I want in the admin, however. How 
can I get the information out independently? 

class aichatbox_input2(models.Model):    
    aichatbox_input2_text = models.CharField(max_length=2000) 
    def __str__(self):
        return self.aichatbox_input2_text


class aichatbox_response2(models.Model):    
    image_url2 =models.CharField(max_length=1000, default='https://www.') 
    response2_text = models.CharField(max_length=1000) 
    aichatbox_response_input2 = models.ManyToManyField(aichatbox_input2)  
    views_aichatbox = models.IntegerField(default=0)
    pw_aichatbox = models.CharField(max_length=12, default='000000')
    link_aichatbox = models.CharField(max_length=250, default='None')
    nickname_aichatbox = models.CharField(max_length=100, 
default='Pseudonym')
    email_aichatbox = models.EmailField(max_length=100, 
default='bl...@blank.com')

    

    def __str__(self):
     
        return u'%s %s' % (self.response2_text, self.image_url2) 
  
class image_url2_class(aichatbox_response2):
    class Meta:
        proxy = True
    def __str__(self):
        return self.image_url2

class response2_text_class(aichatbox_response2):
    class Meta:
        proxy = True
    def __str__(self):
        return self.response2_text

class aichatbox_response_input2_class(aichatbox_response2):
    class Meta:
        proxy = True
    def __str__(self):
        return self.aichatbox_response_input2

class views_aichatbox_class(aichatbox_response2):     
    class Meta:
        proxy = True
    
    def __str__(self):
        return str(self.views_aichatbox)            # is it best to have 
this be str() here? I don't know of a better way to do this...

class pw_aichatbox_class(aichatbox_response2):
    class Meta:
        proxy = True
    def __int__(self):
        return self.pw_aichatbox

class link_aichatbox_class(aichatbox_response2):
    class Meta:
        proxy = True
    def __str__(self):
        return self.link_aichatbox

class nickname_aichatbox_class(aichatbox_response2):
    class Meta:
        proxy = True
    def __str__(self):
        return self.nickname_aichatbox

class email_aichatbox_class(aichatbox_response2):
    class Meta:
        proxy = True
    def __str__(self):
        return self.email_aichatbox

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/622e792a-f782-48e2-acce-54155a8df5d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to