I have a problem in displaying specific columns in my model in django…
I have read in the documentation in about the queryset feature of django.
my question is that it is also possible in django to run just like this query?
select name, age, address from person;
can anyone can give me an idea, i also try it like this
Mymodel.objects.get(name, age, address)
but there are error in the parameter of name, age and address…
thanks…
there are a few different ways. django normally wraps the data in model instances, which is part of the point of the orm. you deal with objects and django deals with the database. so
having said that, if you only want certain attributes, e.g. for performance, you can use values
which returns a list of dicts with those values