Re: How can I serialize filtred FK values.

2019-07-11 Thread Clara Daia
Such a filter will actually select every instance of ModelA with *at least* one related instance of ModelB which matches your filter. The filter will not exclude, in the resulting queryset, the related instances of ModelB that do not match the filter. Em qui, 11 de jul de 2019 às 06:41, Василий Ру

Re: PrimaryKeyRelatedField from property method serialization

2019-05-28 Thread Clara Daia
Renderer', > 'rest_framework.renderers.TemplateHTMLRenderer', > ), > } > > > By adding or subtracting different renderers you can then. You will see > that you can even setup different parsers and renderers for testing. > So I think you are

PrimaryKeyRelatedField from property method serialization

2019-04-25 Thread Clara Daia
Hello, everyone I have a model with a complicated relationship and I am having trouble serializing it. The relationship itself is not particularly relevant: my model may have a history of associations with different instances of itself (think a person who has dated multiple people but can only da

Best way to add bulk operation routes under standard ModelViewSet route

2019-02-15 Thread Clara Daia
Hello, guys I have a standard ModelViewSet for a certain model Resource at /api/resources/. I am now implementing asynchronous bulk operations and would like to associate them to /api/resources/bulk_create/, /api/resources/bulk_update/ and /api/resources/bulk_delete/, each one accepting a POST req

Re: Advice on the correct use of shebang for the django framework run under a virtualenv

2018-11-13 Thread Clara Daia
I believe you do not need the shebang as you will not, in general, be executing any of these files as independent scripts. You just need to make sure `manage.py` is executed with the correct python path. Em ter, 13 de nov de 2018 às 15:21, Bundupress escreveu: > I recently started using Python a

Re: UniqueTogetherValidator does not work for 'simultaneous' creation of multiple instances

2018-10-31 Thread Clara Daia
nst the existing object in the database. >> I think that's why your test case is failing, as the UTV is returning >> true because it is checking for each individual instance separately but >> when trying to create the constraint is failing as expected. >> This is probably a lim

Re: UniqueTogetherValidator does not work for 'simultaneous' creation of multiple instances

2018-10-29 Thread Clara Daia
dive deeper into your code. > And again Clara, don't take parent id from the url, try to send it > directly in the post data. > > So that your request.data looks like: > [ > { > "start_datetime": "2018-10-29", > "install

Re: UniqueTogetherValidator does not work for 'simultaneous' creation of multiple instances

2018-10-29 Thread Clara Daia
a: > model = MyAttributeChangelog > fields = ('__all__') > > > My viewset: > > > class ClaraView(viewsets.ViewSet): > > > def create(self, request): > > ser = MyAttributeChangelogSerializer(data=request.data, many=True) > >

Re: Get filtered data from url

2018-10-26 Thread Clara Daia
I used one of the suggested third party libraries : specifically drf-nested-routers . The 'urls.py' code looks pretty much the same as the example. Em quinta-feira, 11 de outub

UniqueTogetherValidator does not work for 'simultaneous' creation of multiple instances

2018-10-26 Thread Clara Daia
Hello, I have a view that can create multiple instances of a model at once. The model has a unique_together constraint and I made a ModelSerializer based on it, something like class MyAttributeChangelog(models.Model): parent = models.ForeignKey(ParentModel, on_delete=models.CASCADE) sta