Re: Handling of nested form data with a writable nested serializer

2016-06-06 Thread Xavier Ordoquy
Hi Daniel > Le 5 juin 2016 à 10:30, Daniel Haggard a écrit : > > Hi folks, > > I had this issue recently where I had a writeable serializer nesting User > info under the key 'owner', that was passing validation (because it contained > the owner related data) but then

Re: using DRF with something other than models?

2016-06-21 Thread Xavier Ordoquy
Hi, You may also want to look at https://medium.com/django-rest-framework/django-rest-framework-viewset-when-you-don-t-have-a-model-335a0490ba6f It explains how to use a Viewset without models. Regards, Xavier, Linovia. > Le 21 juin 2016 à 04:25, 'Abraham Varricatt' via Django REST framework

Re: Pagination and Filtering

2017-02-02 Thread Xavier Ordoquy
Hi, I can’t think of a reason why they wouldn’t work in particular if the documentation doesn’t says otherwise. Any specific issue that makes you think they don’t ? Regards, Xavier Ordoquy, Linovia. > Le 2 févr. 2017 à 16:07, Thiago Mambretti <wdthi...@gmail.com > <mailto:wdthi.

Re: Not picking up Danish translations

2016-08-31 Thread Xavier Ordoquy
Hi, > Le 31 août 2016 à 11:01, Jeppe Vesterbæk a écrit : > > I'm sending requests with "Accept-Language: da". Translations originating > from Django (eg. "This field is required.") and translations in my own apps > work. Strings in rest framework always are always

Re: Model serializer factory

2016-10-24 Thread Xavier Ordoquy
Hi, > Le 24 oct. 2016 à 14:27, Горобец Дмитрий a écrit : > > Hello, > > Is there a shortcut for making dynamic model serializers like > modelform_factory? No, there’s no such thing for now. However, as you can see from the model form_factory sources, it shouldn’t be too

Re: Pagination In APIView.

2016-11-14 Thread Xavier Ordoquy
The pagination is explained at http://www.django-rest-framework.org/api-guide/pagination/#pagenumberpagination and the configuration on a per view basis is in the second part of http://www.django-rest-framework.org/api-guide/pagination/#setting-the-pagination-style Regards, Xavier Ordoquy

Re: Django Rest Framework - Could not resolve URL for hyperlinked relationship using view name “field-detail”

2016-11-14 Thread Xavier Ordoquy
Hi, You declared your view as "fields" in the routers, so you should use "fields-detail" as the view name for the hyperlink. Regards, Xavier, Linovia. -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group

Re: I need to Filter from multiple tables return a json response

2016-11-22 Thread Xavier Ordoquy
Hi, > Le 23 nov. 2016 à 07:04, pradam.programm...@gmail.com a écrit : > > I need to Filter from multiple tables and return response like this [ {'first > name':'Max',','last name':'Yuri','age':23,'gender':'Male'},{'first > name':'Alex',','last name':'John','age':23,'gender':'Male'}] > in rest

Re: Nesting DRF ViewSets

2016-11-17 Thread Xavier Ordoquy
Hi, > Le 17 nov. 2016 à 09:10, Ryan Sears > a écrit : > > Hi folks! > > I've got a question on nesting viewsets properly to have different permission > classes/contexts. Any extra eyes would be greatly appreciated, as it's been > open for about

Re: Browsable API and Versioning

2016-11-03 Thread Xavier Ordoquy
Hi Robyn, > Le 3 nov. 2016 à 21:22, Robyn Smith a écrit : > > Hello Everyone! > > DRF is amazing. Just a quick thank you to the community! > > I'm working on a project where we're building an API from scratch using the > Django REST Framework, and when working on the

Re: slow query viewset query

2017-01-11 Thread Xavier Ordoquy
Hi, It’s likely either the displayed filter or the create/update form from the browsable API that spans some relation and gets the UI slow. Try to perform the same request as JSON that should validate the previous assomption. Regards, Xavier Ordoquy, Linovia. > Le 11 janv. 2017 à 09:20, M

Re: ModelSerializer doesn't hit update method

2016-11-29 Thread Xavier Ordoquy
Hi > Le 30 nov. 2016 à 05:04, Ashutosh Das a écrit : > > Here is my model: > > class Movie(models.Model): > name = models.CharField(max_length=800, unique=True) > imdb_rating = models.IntegerField(null=True) > movie_choice = ( > ('Act', 'Action'), >

Re: Include drf-based package to section "documenting your api"

2016-12-28 Thread Xavier Ordoquy
subscr...@googlegroups.com > <mailto:django-rest-framework+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. Sure, you need to make a PR for that. It should be explained in the 3rd party sectio

Re: combine two queryset to one Serializers

2016-12-21 Thread Xavier Ordoquy
d() > > > post = Post.objects.all() > post_set = PostSet.objects.all() > > How I can comebine two queryset( as above post, post_set ) from two different > model combine to one ShowSerialzer? > It’s as simple as adding query sets together: full_data = list(post) + list(p

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 <ngu.anto...@gmail.com> a écrit : > > Hi, > > I'm making some tests with the b

Re: Why is 'write_only_fields' not used?

2017-03-17 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 <solsol9...@gmail.com> a écrit : > &g

Re: Why is 'write_only_fields' not used?

2017-03-17 Thread Xavier Ordoquy
ill be removed". Regards, Xavier Ordoquy, Linovia. > Le 17 mars 2017 à 07:43, CocaCola <solsol9...@gmail.com> a écrit : > > Will read_only_fields also disappear? soon? > > > Any reason? > > class SomeSerializer(serializer.ModelSerializer): > cla

Re: DRF Pagination with custom ViewSet

2017-03-15 Thread Xavier Ordoquy
Hi Angus, The first thing would be to fire django debug toolbar and investigate whether the pagination is passed to the context. If it isn’t there’s something in your code that prevents it. If it is, you’ll have to go through the templates to figure. Regards, Xavier Ordoquy, Linovia. -- You

Re: Why is it showing a hashed password?

2017-03-15 Thread Xavier Ordoquy
m. API needs to be designed. It’s HARD and time consuming. It requires knowledge and deep understanding of the requirements. Regards, Xavier Ordoquy, Linovia. -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscri

Re: Writing to Nested ModelSerializer

2017-03-31 Thread Xavier Ordoquy
go quite far. However, while processing the various project requirements we get caught in moving forward with a ModelSerializer where it doesn’t make sense. We bend it and try to make it fit something it’s not a good fit for. Then we blame the framework for being hard to deal with if not worst. Model

Re: Possible bug: date is not translated by serializer

2017-03-31 Thread Xavier Ordoquy
the time. My bet here, you don’t provide TZ information so your JS client may not perform the correct translation. Regards, Xavier Ordoquy, Linovia. > Le 31 mars 2017 à 19:30, marek.onus...@gmail.com a écrit : > > Hi, > > I'm learning Django Rest Framework but otherwise I'm q

Re: How do you implement custom response?

2017-04-17 Thread Xavier Ordoquy
this helps, Xavier Ordoquy, Linovia. > Le 17 avr. 2017 à 09:52, Yanze Dai <daiya...@gmail.com> a écrit : > > I found that the DRF's return value could be various upon different > occasions. So I want to make sure all my JSON return have "code" "message" or

Re: Issue with Built in API Docs

2017-03-10 Thread Xavier Ordoquy
Provided we have a couple of issue ongoing or already fixed on the current issue, I’d expect another release to be out soon, but I have no idea how soon. Meanwhile, installing from master should do. We’ll be focusing on bug fixing in the short term. Regards, Xavier Ordoquy, Linovia. > Le

Re: rest_framework.authtoken is missing in version 3.6.3

2017-06-27 Thread Xavier Ordoquy
Hi, As far as I can tell, it is available and running well. What makes you think it doesn’t ? Regards, Xavier Ordoquy, Linovia. > Le 27 juin 2017 à 19:28, Roberto Santos <py5...@gmail.com> a écrit : > > Dear all > > I've just upgraded from version 3.6.2 to 3.6.3 and re

Re: Custom field implementation of BooleanField not efective when serialized object is retrieved

2017-06-20 Thread Xavier Ordoquy
Hi, We can’t provide any meaningful answer here as you don’t provide any hint about how you wrote the serializer. Regards, Xavier Ordoquy, Linovia. > Le 20 juin 2017 à 08:25, Priyanka Thakur <priyanka.t...@gmail.com> a écrit : > > Hi, > > I have defined a custom field in

Re: Error in tutorial (calling serializer.data)?

2017-06-19 Thread Xavier Ordoquy
() serializer.validated_data serializer.save() But in the latter case, you can’t call serializer.data (doesn’t make sense either as you provided the data in the first place). Hopes this helps, Xavier Ordoquy, Linovia. > Le 19 juin 2017 à 16:05, mrlemon <matthew.le...@gmail.com> a écrit : > > Hi - j

Re: [GitHub Process]: New Project for API Docs?

2017-05-19 Thread Xavier Ordoquy
> Le 19 mai 2017 à 10:42, Carlton Gibson a écrit : > > Hiya, > > I'm trying to get a grip on the tickets relating to the generated API > documentation. My issue is GitHub's tracker doesn't offer great ways of > filtering to just the relevant tickets. Thanks for

Re: PrimaryKeyRelatedField doesn't validate null value even if allow_null=True

2017-05-30 Thread Xavier Ordoquy
writing a test case to demonstrate the issue. Regards, Xavier Ordoquy, Linovia. > Le 30 mai 2017 à 13:33, Priyanka Thakur <priyanka.t...@gmail.com> a écrit : > > Hi Xavier, > > Sorry, I misunderstood the earlier statement "JSON payload.". > > Actually,

Re: pre_save and post_save replacement methods in DRF 3.6.2

2017-06-13 Thread Xavier Ordoquy
Hi, it means you can perform the pre save before calling super’s perform_create/update and then call the post_save from you override perform_create/update. Regards, Xavier Ordoquy, Linovia. > Le 13 juin 2017 à 11:09, Priyanka Thakur <priyanka.t...@gmail.com> a écrit : > > Hi

Re: get_identity method of BaseSerializer removed in DRF 3.x version. But no documentation

2017-06-15 Thread Xavier Ordoquy
Hi, mapping between data and instances is performed when instantiating the serializer. Depending on your use case, it'll be get_object and/or your own code that would substitute to it. Regards, Xavier Ordoquy, Linovia. Le mercredi 14 juin 2017 18:44:09 UTC+2, Priyanka Thakur a écrit : > &

Re: Serializer Field Meta validators

2017-09-11 Thread Xavier Ordoquy
Hi, DRF fields adds the validators during the init rather than setting them on Meta. That help with heritage. You can see how this works at https://github.com/encode/django-rest-framework/blob/master/rest_framework/fields.py#L799-L802 Hope this helps, Regards, Xavier Ordoquy, Linovia. > Le

Re: Regular serializer in browsable api

2017-08-28 Thread Xavier Ordoquy
lp you to get something working. Regards, Xavier Ordoquy, Linovia. > Le 27 août 2017 à 17:54, Ivlev Denis <ivlevdenis...@gmail.com> a écrit : > > > Hi. > I have ModelSerializer with field of regular Serializer, them not showed in > browsable api. What am I doing wrong? >

Re: Django Version 2.0 DRF Support Timeline

2017-12-09 Thread Xavier Ordoquy
Hi joe, Latest DRF version should already be compatible. There may be some regressions here and there that tests didn’t catch, but so are some bugs with 1.11 too. Regards, Xavier. > Le 9 déc. 2017 à 22:53, Joe C a écrit : > > Hey, > > I'm just setting up a new Django

Re: Django Version 2.0 DRF Support Timeline

2017-12-09 Thread Xavier Ordoquy
> Oh, maybe I'll upgrade back to Django 2.0 and try and solve those issues > then. The DRF Docs say Django 2.0 is still in alpha. > > Joe > > On Saturday, December 9, 2017 at 1:55:40 PM UTC-8, Xavier Ordoquy wrote: > Hi joe, > > Latest DRF version should already be com

Re: ValidationError in Snippets tutorial

2018-05-07 Thread Xavier Ordoquy
’: 1, ‘code’: ‘foo’ } ser = SnippetSerializer(data=snippet, many=False) ser.is_valid(raise_exception=True) Regards, Xavier Ordoquy, Linovia. > Le 7 mai 2018 à 12:36, Rainer Hihn <hihn.rai...@gmail.com> a écrit : > > I checked out the Snippets tutorial and set it up working.

Re: Can I use DRF 2.4.x with Django 1.11?

2018-01-15 Thread Xavier Ordoquy
Hi, It’s unlikely that 2.4 supports Django 1.11 out of the box. Either you’ll have to upgrade to a more recent Django REST framework or you’ll have to port DRF 2.4.x Regards, Xavier. > Le 15 janv. 2018 à 17:23, wolfg a écrit : > > Hi, I have a project using Django 1.6.x

Re: Why was auth re-invented? What was missing in django?

2018-01-19 Thread Xavier Ordoquy
Le vendredi 19 janvier 2018 09:44:52 UTC+1, Thomas Güttler a écrit : > > Why was auth re-invented in Django-Rest-Framework? > What was missing in django? > I don't know the initial reasons but from my experience, Django has a couple of non obvious implicit constraints on the authentication /

Re: RequestsClient headers AttributeError

2018-01-22 Thread Xavier Ordoquy
ase instead of Django testcase? If > not, would it make sense to add this caveat in the doc? > > On Monday, January 22, 2018 at 4:53:38 PM UTC-5, Xavier Ordoquy wrote: > No, you are not. See > https://github.com/django/django/blob/master/django/test/testcases.py#L221 > <https

Re: How to build an API where the endpoints don't quite match the underlying database schemata?

2018-01-22 Thread Xavier Ordoquy
Hi, > Le 23 janv. 2018 à 00:57, JI Ioannidis a écrit : > > The tutorial, and pretty much everything else I have found, assumes that the > models defined in models.py map one-to-one to database tables. I need to > build an API for a service that uses the database, of course,

Re: DRF Tutorial Object Level Permissions

2018-01-09 Thread Xavier Ordoquy
Hi You should rename « permissions_classes » into « permission_classes » (note it is one letter shorter). Regads, Xavier, Linovia. > Le 10 janv. 2018 à 07:48, Craig Wilson a écrit : > > I'm working through the DRF tutorial and everything has been working fine up

Re: Django REST Framework

2018-01-30 Thread Xavier Ordoquy
Hi, I don’t think it ever had. What are you referring to ? Regards, Xavier. > Le 30 janv. 2018 à 11:03, Cynthia Simiyu a > écrit : > > compat.py missing def set_many in version 3.7.7, why? > > -- > You received this message because you are subscribed to the

Re: Django REST Framework

2018-01-30 Thread Xavier Ordoquy
This was a compatibility layer to be compatible with Django < 1.10. Since it’s not supported any longer it has been removed. > Le 30 janv. 2018 à 11:06, Xavier Ordoquy <xordo...@linovia.com> a écrit : > > Hi, > > I don’t think it ever had. What are you referring to

Re: getting 401 for invalid token not 403

2018-02-07 Thread Xavier Ordoquy
Hi, The documentation also says that it will use the first scheme to figure out whether it should respond a 401 or 403 and SessionAuthentication will return a 403 upon unauthenticated unauthorized request. I provided the links in a similar SO response. Regards, Xavier, Linovia. > Le 7 févr.

Re: query param detail route django rest returns 500

2018-02-16 Thread Xavier Ordoquy
It looks like you are using `query_param` to filter your dataset. The detail_route is based on the filtered dataset. However, there’s no reason the get_object returns more than one item. Maybe the project overrides the get_object in a way that breaks. Regards, Xavier Ordoquy, Linovia. > Le

Re: Error in documentation?

2018-01-01 Thread Xavier Ordoquy
Hi, Indeed, nice catch. This was fixed in https://github.com/encode/django-rest-framework/pull/5713 but hasn’t been deployed yet (will be for the next release). Regards, Xavier. > Le 1 janv. 2018 à 22:36, Victor M. Mendiola Lau a écrit : > > Hello everybody. > > I'm new

Re: RequestsClient headers AttributeError

2018-01-22 Thread Xavier Ordoquy
Hi, Your code sample works fine on my installation. Ensure you do use the DRF’s RequestsClient and not Django’s. Regards, Xavier, Linovia. > Le 22 janv. 2018 à 22:29, Leo T a écrit : > > The following code produces the following error. Have I missed something? I >

Re: RequestsClient headers AttributeError

2018-01-22 Thread Xavier Ordoquy
sClient object. If > I don't include the faulty line, I get the expected HTTP 401 Unauthorized as > I am not sending the JWT token (I removed Basic and Session authentication in > the settings). > > Any idea of what might cause the problem? > > Thanks > > >

Re: DateTimeField serializer different values specifying 'DATETIME_FORMAT': "%Y-%m-%dT%H:%M:%S%z",

2018-03-14 Thread Xavier Ordoquy
Hi, > Le 14 mars 2018 à 14:53, Daviddd a écrit : > > Hello All, > > I'm using Django 2.0.1 and DRF djangorestframework==3.7.7 with USE_TZ = True. > > The model field is declared as > > modified = models.DateTimeField(auto_now=True) > > > Serializer > > ** > class

Re: Optional trailing slashes in Routers

2018-04-13 Thread Xavier Ordoquy
The solution proposed on SO looks sensible to me. I think the optional trailing slash is a bad idea because you won’t have a unique identifier for representation any longer. Regards, Xavier Ordoquy, Linovia; > Le 13 avr. 2018 à 11:39, German Prostakov <gprostm...@gmail.com>

Re: Any good practice to caching ListAPIView?

2018-03-21 Thread Xavier Ordoquy
Hi, The message says that you are trying to pickle the response - which is done through the cache.set(key, res,60) call - while the response is not rendered yet. This should be fixed by accessing response.content before calling the cache.set Regards, Xavier Ordoquy, Linovia. Le mardi 20 mars

Re: Composable permissions question

2018-10-31 Thread Xavier Ordoquy
Hi, It’s more a bug in DRF. Could you open an issue about that so we can keep it on our radars ? Regards, Xavier, Linovia. > Le 31 oct. 2018 à 19:49, Frank Bohnsack a écrit : > > While trying out the new composable permission feature, I have the following > problem: > > >>> IsAuthenticated

Re: Basic understanding / custom field - point of access

2018-10-30 Thread Xavier Ordoquy
Hi, It’s a bit more complex than that. Content négociation along with renderers and parsers will move the data from the HTTP body into basic python types (int / floats / strings). Serializers will move those basic types from and to more complex ones (DateTimes, Decimals, Django models /

Re: Invalid source attribute does not throw an error

2018-11-15 Thread Xavier Ordoquy
Hi, There are no errors because the value gets map to the instance’s « abc ». It could be a property with setters / getters that process the value and fill some of the model’s field (or the other way around). For example, you could have a write only property « password » that takes a password,

Re: import error in tutorial quickstart

2018-11-29 Thread Xavier Ordoquy
To avoid creating another tutorial directory Regards, Xavier O. > Le 29 nov. 2018 à 18:59, vijay.b.seh...@gmail.com a écrit : > > Why is . used after djan*** tutorial '.' ? > > On Monday, March 13, 2017 at 11:50:08 AM UTC+5:30, Xavier Ordoquy wrote: > Hi madame, &g

Re: Invalid source attribute does not throw an error

2018-11-19 Thread Xavier Ordoquy
gt;>> d.a 1 >>> Regards, Xavier O. > So why this error is not raised? > > Regards > Andi > > Am Donnerstag, 15. November 2018 18:08:36 UTC+1 schrieb Xavier Ordoquy: > Hi, > > There are no errors because the value gets map to the instance’s « abc ». > It cou

Re: Bulk validation and creation

2018-11-19 Thread Xavier Ordoquy
Hi, This is an issue I faced 2 or 3 years ago. I ended up rewriting most of the serializer with custom code. I checked a few things by myself first and used bulk inserts. If everything went fine, good, I could send back how happy the server was within a few seconds. If there was errors, I did

Re: perform_create never called, despite being recommended by docs

2019-04-06 Thread Xavier Ordoquy
> > Alex > >> On 6 Apr 2019, at 20:43, Xavier Ordoquy > <mailto:xordo...@linovia.com>> wrote: >> >> Hi, >> >> Did you first ensure the client’s request is valid ? What’s the response >> code ? >> Most likely, the request is invalid

Re: Composable permissions question

2019-02-22 Thread Xavier Ordoquy
Hi, We might do that but handling None a is side effect that is not supported. Documentation (https://www.django-rest-framework.org/api-guide/permissions/#custom-permissions) says: The methods should return True if the request should be granted access, and False otherwise. Regards, Xavier

Re: Documentation for earlier version of DRF 3.X

2019-01-30 Thread Xavier Ordoquy
Hi, You will need to: - checkout the tag - installing the dependencies found in requirements/requirements-documentation.txt and requirements/requirements-testing.txt - generate the documentation with mkdocs build Regards, Xavier O. > Le 30 janv. 2019 à 12:29, ankGT a écrit : > > I

Re: [feature request] permission required decorator for drf api views

2019-07-22 Thread Xavier Ordoquy
Hi, Class based views have a permission_classes setting (https://www.django-rest-framework.org/api-guide/permissions/#setting-the-permission-policy ) and function based views have a @permission_classes

Re: rest framework

2020-11-03 Thread Xavier Ordoquy
Hi, Also make sure you install it first. Django REST frameworks kickstart (https://www.django-rest-framework.org/tutorial/quickstart/#project-setup ) should help you get it working. Regards, Xavier O. > Le 3 nov. 2020

Re: 'Article' object is not iterable ,why this error is popping up,while fetching data using primary no

2020-11-03 Thread Xavier Ordoquy
Hi, Please, paste your code in the mail instead of screenshots, it makes it hard to read. In your view, you are passing an Article instance to your serializer along with the many=True keyword which means the serializer will expect an iterable of Articles as the error suggests. Regards, Xavier

Re: 'Article' object is not iterable ,why this error is popping up,while fetching data using primary no

2020-11-03 Thread Xavier Ordoquy
The question is, what are you trying to do and what outcome are you expecting ? > Le 4 nov. 2020 à 07:28, Ashutosh Mishra a écrit > : > > So how can I resolve this? > > On Wed 4 Nov, 2020, 11:56 Xavier Ordoquy, <mailto:xordo...@linovia.com>> wrote: > Hi

Version 3.12.2 now available

2020-11-05 Thread Xavier Ordoquy
Django REST framework 3.12.2 is now available on PyPI. https://pypi.org/project/djangorestframework/ See the release notes for more details: https://www.django-rest-framework.org/community/release-notes/#3122 Thanks to

Re: anyone solve this problem

2021-01-08 Thread Xavier Ordoquy
Hi, The Django REST Framework tutorial, step6 should show you how to do that. The SnippetViewSet uses the SnippetSerializer to set the current user as the owner of the snippet created. Regards, Linovia, Xavier O. > Le 8 janv. 2021 à 12:43, Praveen chaduvala a écrit : > > django - how to add