Usually in a django view you would do something like
queryset = MyModel.objects.something()
How do I get more control over the shape of the object returned. Sorry for the heresy, but in ASP.Net MVC (I only quote this because I’m more familiar with it), I would do something like.
from e in MyModel
select new {
e.Field1,
e.Field2
}
I’m looking to do something similar in Django. I’m using backbone so need to re-shape the model where I would usually use tags in my templates.
You’re looking for a such called
Managers.Official documentation has pretty good description.
I’d recommend you to read ‘Pro Django’ book by Apress.