Hello everyone,

I am working on designing a user interface for a legacy database.
Using python manage.py inspectdb I got the following models:

class Columnnames(models.Model):                                           
     
    id = models.BigAutoField(primary_key=True)                             
     
    name = models.TextField(blank=True, null=True)                         
     
                                                                            
    
    class Meta:                                                             
    
        managed = False                                                     
    
        db_table = 'columnnames'                                           
     
                                                                            
    
                                                                            
    
class Columns(models.Model):                                               
     
    id = models.BigAutoField(primary_key=True)                             
     
    name = models.TextField(blank=True, null=True)                         
     
    dataset = models.ForeignKey('Datasets', models.DO_NOTHING)             
     
    columnname = models.ForeignKey(Columnnames, models.DO_NOTHING)         
     
                                                                            
    
    class Meta:                                                             
    
        managed = False                                                     
    
        db_table = 'columns'


where as my current view is:

class IndexView(generic.ListView):                                         
     
    template_name = "db/index.html"                                         
  
    paginate_by = 50                                                       
     
    context_object_name = 'Columns'                                         
    
    queryset = Columns.objects.all()


However, this gives me entries that end up looking like this:

            [name]                                [Dataset]                 
     [Columnnames ]
Ave_rent_1_bedroom       Datasets object          Columnnames object
....

Is there a way of spaning the relationship between `Columns` and 
`Columnnames` so that Columns.objects.all() outputs the actual entry for 
the [Columnnames ] field instead of just "Columnnames object"?

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/a410b3a3-cc71-489e-98c9-3eeaeb0c0285%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to