Re: Relationships exposed over RESTful interface

2014-04-11 Thread Conrad Rowlands
It seems Defining the ManufacturerModelSerialiser thus has solved the problem (which backs up my last mail I think). Its not entirely what I wanted but it at least gets me down to just doing the 1 Query as I originally intended, 1 query is always better than 4000 odd! class ManufacturerModelSe

Re: Relationships exposed over RESTful interface

2014-04-11 Thread Conrad Rowlands
OK . I take on board point 1 As for point two... I commented the ManufacturerViewset and the references to it in urls.py ,then when i run the url that I believe only looks at ManufacturerModelViewSet i get the following error: Could not resolve URL for hyperlinked relationship using view na

Re: Relationships exposed over RESTful interface

2014-04-11 Thread Javier Guerra Giraldez
On Fri, Apr 11, 2014 at 8:31 AM, Conrad Rowlands wrote: > As you can see the queryset is loading all from the database What I > would prefer to be able to do is to share the first queryset from the > ManufacturerModelViewSet (which should have all of the correct fields) with > the Manufacturer

Re: Relationships exposed over RESTful interface

2014-04-11 Thread Conrad Rowlands
Hi Javier, Sorry for not being a bit clearer. Basically I am making a URL call to return all of the models with a given manufacturer. So the first SQL statement generated is returning all of the ManufacturerModel AND (because of the select related) all of the Manufacturers too in one query. Th

Re: Relationships exposed over RESTful interface

2014-04-11 Thread Javier Guerra Giraldez
On Fri, Apr 11, 2014 at 3:51 AM, Conrad Rowlands wrote: > I would still be keen to know if there is any know method that would allow > me to load this data using only the 1 queries bringing in all of the related > fields in the original query. what's the first query about? probably it's part of

Re: Relationships exposed over RESTful interface

2014-04-11 Thread Conrad Rowlands
Hi Javier, Thank you for your quick response. Sadly I could not get your solution to work however you helped to point me in the right direction to a workable though not entirely satisfactorey solution. What I did was to refactor my ViewSet Class thus:- class ManufacturerModelViewSet(viewsets.

Re: Relationships exposed over RESTful interface

2014-04-10 Thread Javier Guerra Giraldez
On Thu, Apr 10, 2014 at 8:29 AM, Conrad Rowlands wrote: > Why is this and how can I stop this behaviour but still bring back the > Manufacturer Details. I expected instead the first query to load all of the > data. override the get_collection() method in your View (or ViewSet) to add a select_re

Relationships exposed over RESTful interface

2014-04-10 Thread Conrad Rowlands
Hi, I have an issue with regard to exposing a RESTful interface using filtersets and HyperLinkedModelserialisers. I have two model classes defined thus: class Manufacturer(CommonExtendedIcon): WebSite=models.CharField(max_length=1024) StandardList=models.BooleanField(default=False)