Switching from primaryrelatedField to Nestedserializer ?

2017-03-16 Thread hdzyounes10
I am using a nested serializer. I need ProfileSerializer to return full related Project object for get requests and consider only id switching (changing current) like with relatedPrimaryField behaiviour for post/put requests on ProfileSerializer. any solutions on how to achieve this ? class P

Re: 'api-docs' is not a registered namespace

2017-03-16 Thread Antoine Nguyen
Stupid question: have you installed the coreapi package? Antoine Le lundi 13 mars 2017 17:18:56 UTC+1, Daviddd a écrit : > > Dear All, > > Django 1.10.6 > Django-rest-framework 3.6.2 > > > ``` > #api/urls.py > def include_version(version): > """ > Returns an include statement containing U

Problem interacting with API using the generated documentation

2017-03-16 Thread Antoine Nguyen
Hi, I'm making some tests with the built-in documentation (really nice work btw) and it looks like the interactive mode does not work completly. I'm playing with a list operation, I can see the request is sent and that it returns data but it is not displayed in the window, I just get an "undef

Re: Problem interacting with API using the generated documentation

2017-03-16 Thread Xavier Ordoquy
Hi, Logs from the server would really be helpful here. What does it says ? 500 ? 400 ? If 500, what’s the traceback ? Regards, Xavier Ordoquy, Linovia. > Le 16 mars 2017 à 16:51, Antoine Nguyen a écrit : > > Hi, > > I'm making some tests with the built-in documentation (really nice work btw)

Re: Problem interacting with API using the generated documentation

2017-03-16 Thread Antoine Nguyen
That's the problem, there is no error... (python or js) Return code is 200 and I see valid data when I inspect the response using Firebug. Antoine 2017-03-16 17:00 GMT+01:00 Xavier Ordoquy : > Hi, > > Logs from the server would really be helpful here. > What does it says ? 500 ? 400 ? > If 500,

Re: Problem interacting with API using the generated documentation

2017-03-16 Thread Antoine Nguyen
Ok, it looks like a browser issue. I can see the result when I use chromium but not when I use Firefox ESR (45.8) on a Debian 8 system. Antoine 2017-03-16 17:02 GMT+01:00 Antoine Nguyen : > That's the problem, there is no error... (python or js) > > Return code is 200 and I see valid data when

Why is 'write_only_fields' not used?

2017-03-16 Thread CocaCola
in documents.. The write_only_fields option on ModelSerializer has been moved to PendingDeprecation and replaced with a more generic extra_kwargs http: //www.django-rest-framework.org/topics/3.0-announcement/#the-extra_kwargs-option Why do not you use 'write_only_fields' while using 'read_onl

Re: Why is 'write_only_fields' not used?

2017-03-16 Thread Xavier Ordoquy
Hi, We didn’t remove the read_only_fields as it’s pretty common. However, I would be willing to remove the read_only_fields since the extra_kwargs is already there. Regards, Xavier Ordoquy, Linovia. > Le 17 mars 2017 à 07:01, CocaCola a écrit : > > in documents.. > > The write_only_fields op

Associate own user (logged user) with url path e.g: /me

2017-03-16 Thread Damjan Dimitrioski
What I need to do is to have something like: /api/users/me to point to my current user. Requirements: 1) I need to be able to do GET, PUT on the object One of the following can be helpful: 1) Bind url path to record 2) Custom callback to return the serialization object So, what is the best way

Re: Why is 'write_only_fields' not used?

2017-03-16 Thread CocaCola
> > Will read_only_fields also disappear? soon? > Any reason? class SomeSerializer(serializer.ModelSerializer): class Meta: model = SomeModel fields = ('somefield1', 'somefield2', 'somefield3') extra_kwargs = { 'somefield2': {'write_only': True},

Re: Why is 'write_only_fields' not used?

2017-03-16 Thread Xavier Ordoquy
My opinion is that read_only_fields feature is already provided by extra_kwargs which does much more than just set the read/write flag. That would also help provide this feature which is under used by users. Note that I said "I’m willing to remove it" and did *not* say "it will be removed". Re