Re: DRF question

2022-07-24 Thread Ram
Hi Jason,

Thank you for your email.

1. I'm not sure what you are referring to 'template-based' responses with
RESTFUL?

2. Also we are not looking for extensibility to be smooth. My concern is
why we need to change the existing implementation in user registration when
DRF is a separate package?

3. Let me explain to you why we are adding REST APIs now after completing
all the apps in regular Django. We need to port our whole site to a mobile
app. So to make it compatible for a mobile app, we are adding REST APIs.

Please let me know if this is still doable without changing the user
registration?

Best regards,
~Ram

On Sat, Jul 23, 2022 at 4:28 PM Jason  wrote:

> sure, it can be used to extend, but you're also equating template-based
> responses with restful.  those are pretty differnet paradigims, so you do
> need to account for the different use cases.  there's a reason why DRF is a
> separate package built on top of django, and not in core.  because its a
> pretty significant retrofit.
>
> You can absolutely do regular django and DRF in a same project, it just
> seems that your expecting "extensibility" to be a seamless one to one
> transfer, and that isn't the case.
>
> Also, i think you aren't considering ways to architect this structure.
> ie, have `api/v1/user` deal with HTTP verbs, while having `/user` deal with
> legacy django.  One deals with a DRF endpoint, whther apiview, generic, or
> viewset. your choice.  the second deals with a model form.  you can then
> determine what is the shared functionality between the two that is outside
> the frameworks, and then have your separate handlers call that thing as
> part of their flow.
>
> On Saturday, July 23, 2022 at 1:04:52 PM UTC-4 ram.mu...@gmail.com wrote:
>
>> Hi Jason,
>>
>> Thank you for your email. I expected DRF could be an extensible feature
>> rather than forcing to change existing implementation. Extensibility
>> practice happens in many open source and enterprise projects. That is why
>> I'm shocked to learn this.
>>
>> Best regards,
>> ~Ram
>>
>>
>>
>> On Sat, Jul 23, 2022 at 4:56 AM Jason  wrote:
>>
>>> Ram, what did you expect, to be honest?  Going from forms to rest are
>>> two different implementation details for the same concept.  When you do
>>> such things, you need to evaluate whether the tradeoffs are worth it.
>>>
>>>
>>> On Saturday, July 23, 2022 at 1:30:43 AM UTC-4 ram.mu...@gmail.com
>>> wrote:
>>>
 Hi Thomas & Julio,

 Thank you for your answers, but we are shocked to learn that our user
 registration functionality has to be rewritten again to create REST APIs.
 That means whatever Apps that we developed on User registration have to be
 modified too and this further means that we will have to redevelop our
 whole Apps (6 of them). I still can not believe this?

 I hope someone has a clue about this problem and I'm wondering
 whether anyone ran into this situation as us.

 Best regards,
 ~Ram


 On Wed, Jul 20, 2022 at 10:44 PM Julio Cojom 
 wrote:

> Hi Ram,
>
> Aditional to all the suggestions, please keep in mind django-filters
> as they are important to filter data in your api requests
>
> Regards,
>
> Julio Cojom
>
> El mié, 20 jul 2022 a las 20:37, Michael Thomas (<
> michael.t...@gmail.com>) escribió:
>
>> There's no reason at all that DRF can't be used to do this. Just
>> don't use a viewset, as it's not the right fit for this type of thing.
>> Read through the code for how your current system works, then
>> re-implement the relevant parts as DRF ApiView's.
>>
>> On Thu, Jul 21, 2022 at 8:43 AM Ram  wrote:
>>
>>> Thank you all for quick suggestions.
>>>
>>> We are stuck with implementing the first API, which is login
>>> endpoint. That means since we already developed user registration
>>> functionality before without DRF, there seems no way to create a login
>>> endpoint so that an existing registered user can login using REST API 
>>> and
>>> access his/her respective data . All we are finding on the web is to 
>>> create
>>> an Abstract user using DRF which requires to change the existing user
>>> registration implementation. So I'm wondering whether there is any way 
>>> to
>>> remedify this or are we missing something?
>>>
>>> Best regards,
>>> ~Ram
>>>
>>>
>>>
>>> On Tue, Jul 19, 2022 at 6:30 PM Hella thor 
>>> wrote:
>>>
 Hi Ram
 您可以在原来项目的基础上创建新的APP来单独给移动应用程序来使用,并在整体项目完成以后研究是不是需要DRF来兼容。

 Lalit Suthar  于2022年7月19日周二 19:04写道:

> I would also suggest keeping Django views as it is and writing new
> views for your APIs
> maybe you can create another file named apiviews.py and then write
> new APIs with help of your present views
> refer: https://www.django-rest-framework.org/api-guide/views/

Re: DRF question

2022-07-24 Thread Ram
Hi Jason,is separ

Thank you for your email.

1. I'm not sure what you are referring to 'template-based' responses with
RESTFUL?

2. Also we are not looking for extensibility to be smooth. My concern is
why we need to change the existing implementation in user registration when
DRF is a separate package?

3. Let me explain to you why we are adding REST APIs now after completing
all the apps in regular Django. We need to port our whole site to a mobile
app. So to make it compatible for a mobile app, we are adding REST APIs.

Please let me know if this is still doable without changing the user
registration?

Best regards,
~Ram

On Sat, Jul 23, 2022 at 4:28 PM Jason  wrote:

> sure, it can be used to extend, but you're also equating template-based
> responses with restful.  those are pretty differnet paradigims, so you do
> need to account for the different use cases.  there's a reason why DRF is a
> separate package built on top of django, and not in core.  because its a
> pretty significant retrofit.
>
> You can absolutely do regular django and DRF in a same project, it just
> seems that your expecting "extensibility" to be a seamless one to one
> transfer, and that isn't the case.
>
> Also, i think you aren't considering ways to architect this structure.
> ie, have `api/v1/user` deal with HTTP verbs, while having `/user` deal with
> legacy django.  One deals with a DRF endpoint, whther apiview, generic, or
> viewset. your choice.  the second deals with a model form.  you can then
> determine what is the shared functionality between the two that is outside
> the frameworks, and then have your separate handlers call that thing as
> part of their flow.
>
> On Saturday, July 23, 2022 at 1:04:52 PM UTC-4 ram.mu...@gmail.com wrote:
>
>> Hi Jason,
>>
>> Thank you for your email. I expected DRF could be an extensible feature
>> rather than forcing to change existing implementation. Extensibility
>> practice happens in many open source and enterprise projects. That is why
>> I'm shocked to learn this.
>>
>> Best regards,
>> ~Ram
>>
>>
>>
>> On Sat, Jul 23, 2022 at 4:56 AM Jason  wrote:
>>
>>> Ram, what did you expect, to be honest?  Going from forms to rest are
>>> two different implementation details for the same concept.  When you do
>>> such things, you need to evaluate whether the tradeoffs are worth it.
>>>
>>>
>>> On Saturday, July 23, 2022 at 1:30:43 AM UTC-4 ram.mu...@gmail.com
>>> wrote:
>>>
 Hi Thomas & Julio,

 Thank you for your answers, but we are shocked to learn that our user
 registration functionality has to be rewritten again to create REST APIs.
 That means whatever Apps that we developed on User registration have to be
 modified too and this further means that we will have to redevelop our
 whole Apps (6 of them). I still can not believe this?

 I hope someone has a clue about this problem and I'm wondering
 whether anyone ran into this situation as us.

 Best regards,
 ~Ram


 On Wed, Jul 20, 2022 at 10:44 PM Julio Cojom 
 wrote:

> Hi Ram,
>
> Aditional to all the suggestions, please keep in mind django-filters
> as they are important to filter data in your api requests
>
> Regards,
>
> Julio Cojom
>
> El mié, 20 jul 2022 a las 20:37, Michael Thomas (<
> michael.t...@gmail.com>) escribió:
>
>> There's no reason at all that DRF can't be used to do this. Just
>> don't use a viewset, as it's not the right fit for this type of thing.
>> Read through the code for how your current system works, then
>> re-implement the relevant parts as DRF ApiView's.
>>
>> On Thu, Jul 21, 2022 at 8:43 AM Ram  wrote:
>>
>>> Thank you all for quick suggestions.
>>>
>>> We are stuck with implementing the first API, which is login
>>> endpoint. That means since we already developed user registration
>>> functionality before without DRF, there seems no way to create a login
>>> endpoint so that an existing registered user can login using REST API 
>>> and
>>> access his/her respective data . All we are finding on the web is to 
>>> create
>>> an Abstract user using DRF which requires to change the existing user
>>> registration implementation. So I'm wondering whether there is any way 
>>> to
>>> remedify this or are we missing something?
>>>
>>> Best regards,
>>> ~Ram
>>>
>>>
>>>
>>> On Tue, Jul 19, 2022 at 6:30 PM Hella thor 
>>> wrote:
>>>
 Hi Ram
 您可以在原来项目的基础上创建新的APP来单独给移动应用程序来使用,并在整体项目完成以后研究是不是需要DRF来兼容。

 Lalit Suthar  于2022年7月19日周二 19:04写道:

> I would also suggest keeping Django views as it is and writing new
> views for your APIs
> maybe you can create another file named apiviews.py and then write
> new APIs with help of your present views
> refer: https://www.django-rest-framework.org/api-guide/views/

Re: DRF question

2022-07-23 Thread Jason
sure, it can be used to extend, but you're also equating template-based 
responses with restful.  those are pretty differnet paradigims, so you do 
need to account for the different use cases.  there's a reason why DRF is a 
separate package built on top of django, and not in core.  because its a 
pretty significant retrofit.

You can absolutely do regular django and DRF in a same project, it just 
seems that your expecting "extensibility" to be a seamless one to one 
transfer, and that isn't the case.

Also, i think you aren't considering ways to architect this structure.  ie, 
have `api/v1/user` deal with HTTP verbs, while having `/user` deal with 
legacy django.  One deals with a DRF endpoint, whther apiview, generic, or 
viewset. your choice.  the second deals with a model form.  you can then 
determine what is the shared functionality between the two that is outside 
the frameworks, and then have your separate handlers call that thing as 
part of their flow.

On Saturday, July 23, 2022 at 1:04:52 PM UTC-4 ram.mu...@gmail.com wrote:

> Hi Jason,
>
> Thank you for your email. I expected DRF could be an extensible feature 
> rather than forcing to change existing implementation. Extensibility 
> practice happens in many open source and enterprise projects. That is why 
> I'm shocked to learn this. 
>
> Best regards,
> ~Ram
>
>
>
> On Sat, Jul 23, 2022 at 4:56 AM Jason  wrote:
>
>> Ram, what did you expect, to be honest?  Going from forms to rest are two 
>> different implementation details for the same concept.  When you do such 
>> things, you need to evaluate whether the tradeoffs are worth it.
>>
>>
>> On Saturday, July 23, 2022 at 1:30:43 AM UTC-4 ram.mu...@gmail.com wrote:
>>
>>> Hi Thomas & Julio,
>>>
>>> Thank you for your answers, but we are shocked to learn that our user 
>>> registration functionality has to be rewritten again to create REST APIs. 
>>> That means whatever Apps that we developed on User registration have to be 
>>> modified too and this further means that we will have to redevelop our 
>>> whole Apps (6 of them). I still can not believe this? 
>>>
>>> I hope someone has a clue about this problem and I'm wondering 
>>> whether anyone ran into this situation as us.
>>>
>>> Best regards,
>>> ~Ram
>>>
>>>
>>> On Wed, Jul 20, 2022 at 10:44 PM Julio Cojom  
>>> wrote:
>>>
 Hi Ram,

 Aditional to all the suggestions, please keep in mind django-filters as 
 they are important to filter data in your api requests 

 Regards,

 Julio Cojom

 El mié, 20 jul 2022 a las 20:37, Michael Thomas (<
 michael.t...@gmail.com>) escribió:

> There's no reason at all that DRF can't be used to do this. Just don't 
> use a viewset, as it's not the right fit for this type of thing.
> Read through the code for how your current system works, then 
> re-implement the relevant parts as DRF ApiView's.
>
> On Thu, Jul 21, 2022 at 8:43 AM Ram  wrote:
>
>> Thank you all for quick suggestions. 
>>
>> We are stuck with implementing the first API, which is login 
>> endpoint. That means since we already developed user registration 
>> functionality before without DRF, there seems no way to create a login 
>> endpoint so that an existing registered user can login using REST API 
>> and 
>> access his/her respective data . All we are finding on the web is to 
>> create 
>> an Abstract user using DRF which requires to change the existing user 
>> registration implementation. So I'm wondering whether there is any way 
>> to 
>> remedify this or are we missing something?
>>
>> Best regards,
>> ~Ram
>>
>>
>>
>> On Tue, Jul 19, 2022 at 6:30 PM Hella thor  
>> wrote:
>>
>>> Hi Ram
>>> 您可以在原来项目的基础上创建新的APP来单独给移动应用程序来使用,并在整体项目完成以后研究是不是需要DRF来兼容。
>>>
>>> Lalit Suthar  于2022年7月19日周二 19:04写道:
>>>
 I would also suggest keeping Django views as it is and writing new 
 views for your APIs 
 maybe you can create another file named apiviews.py and then write 
 new APIs with help of your present views
 refer: https://www.django-rest-framework.org/api-guide/views/

 On Tue, 19 Jul 2022 at 06:38, Nikhil Chawla  
 wrote:

> Don't clutter the django views with DRF requests. Keep them 
> separate, available at, say `api` endpoints.
>
> On Tue, 19 Jul 2022, 06:17 Michael Thomas,  
> wrote:
>
>> Hey Ram,
>>
>> I'm afraid no one can answer your questions without knowing your 
>> code, how it works, or anything else...
>>
>> Broadly speaking, here's how we approached a similar scenario:
>>
>> 1) Created one or more Serializer for each model that required 
>> interaction via API. Some models required more than one, as they 
>> were 
>> either too large for 

Re: DRF question

2022-07-23 Thread Ram
Hi Jason,

Thank you for your email. I expected DRF could be an extensible feature
rather than forcing to change existing implementation. Extensibility
practice happens in many open source and enterprise projects. That is why
I'm shocked to learn this.

Best regards,
~Ram



On Sat, Jul 23, 2022 at 4:56 AM Jason  wrote:

> Ram, what did you expect, to be honest?  Going from forms to rest are two
> different implementation details for the same concept.  When you do such
> things, you need to evaluate whether the tradeoffs are worth it.
>
>
> On Saturday, July 23, 2022 at 1:30:43 AM UTC-4 ram.mu...@gmail.com wrote:
>
>> Hi Thomas & Julio,
>>
>> Thank you for your answers, but we are shocked to learn that our user
>> registration functionality has to be rewritten again to create REST APIs.
>> That means whatever Apps that we developed on User registration have to be
>> modified too and this further means that we will have to redevelop our
>> whole Apps (6 of them). I still can not believe this?
>>
>> I hope someone has a clue about this problem and I'm wondering
>> whether anyone ran into this situation as us.
>>
>> Best regards,
>> ~Ram
>>
>>
>> On Wed, Jul 20, 2022 at 10:44 PM Julio Cojom 
>> wrote:
>>
>>> Hi Ram,
>>>
>>> Aditional to all the suggestions, please keep in mind django-filters as
>>> they are important to filter data in your api requests
>>>
>>> Regards,
>>>
>>> Julio Cojom
>>>
>>> El mié, 20 jul 2022 a las 20:37, Michael Thomas ()
>>> escribió:
>>>
 There's no reason at all that DRF can't be used to do this. Just don't
 use a viewset, as it's not the right fit for this type of thing.
 Read through the code for how your current system works, then
 re-implement the relevant parts as DRF ApiView's.

 On Thu, Jul 21, 2022 at 8:43 AM Ram  wrote:

> Thank you all for quick suggestions.
>
> We are stuck with implementing the first API, which is login endpoint.
> That means since we already developed user registration functionality
> before without DRF, there seems no way to create a login endpoint so that
> an existing registered user can login using REST API and access his/her
> respective data . All we are finding on the web is to create an Abstract
> user using DRF which requires to change the existing user registration
> implementation. So I'm wondering whether there is any way to remedify this
> or are we missing something?
>
> Best regards,
> ~Ram
>
>
>
> On Tue, Jul 19, 2022 at 6:30 PM Hella thor 
> wrote:
>
>> Hi Ram
>> 您可以在原来项目的基础上创建新的APP来单独给移动应用程序来使用,并在整体项目完成以后研究是不是需要DRF来兼容。
>>
>> Lalit Suthar  于2022年7月19日周二 19:04写道:
>>
>>> I would also suggest keeping Django views as it is and writing new
>>> views for your APIs
>>> maybe you can create another file named apiviews.py and then write
>>> new APIs with help of your present views
>>> refer: https://www.django-rest-framework.org/api-guide/views/
>>>
>>> On Tue, 19 Jul 2022 at 06:38, Nikhil Chawla 
>>> wrote:
>>>
 Don't clutter the django views with DRF requests. Keep them
 separate, available at, say `api` endpoints.

 On Tue, 19 Jul 2022, 06:17 Michael Thomas, 
 wrote:

> Hey Ram,
>
> I'm afraid no one can answer your questions without knowing your
> code, how it works, or anything else...
>
> Broadly speaking, here's how we approached a similar scenario:
>
> 1) Created one or more Serializer for each model that required
> interaction via API. Some models required more than one, as they were
> either too large for list() operations, or required a simpler
> representation when nested into another Serializer, etc..
> 2) Created custom permissions to check if users were allowed to
> perform the action(s) they were trying to make
> 3) Created ViewSets using the permissions and serializers
> mentioned above, as well as any additional actions that didn't fit 
> within
> the normal REST verbs
> 4) Created a router and registered the viewsets with it
> 5) Added the router's urls into the projects url configuration
>
> I hope that's useful :)
>
> Kind Regards,
> Michael Thomas
>
> On Tue, Jul 19, 2022 at 7:21 AM Ram  wrote:
>
>> Hi,
>>
>> We completed coding all the features without DRF for our web site
>> and now we are planning to develop a mobile app for the same website 
>> by
>> keeping the web site as it is and develop a mobile app using Flutter.
>>
>> Based on our understanding, we have do the following in the
>> current code for adding REST APIs
>>
>>
>>1. We have to create serializers.py for each model in each
>>App 

Re: DRF question

2022-07-23 Thread Jason
Ram, what did you expect, to be honest?  Going from forms to rest are two 
different implementation details for the same concept.  When you do such 
things, you need to evaluate whether the tradeoffs are worth it.


On Saturday, July 23, 2022 at 1:30:43 AM UTC-4 ram.mu...@gmail.com wrote:

> Hi Thomas & Julio,
>
> Thank you for your answers, but we are shocked to learn that our user 
> registration functionality has to be rewritten again to create REST APIs. 
> That means whatever Apps that we developed on User registration have to be 
> modified too and this further means that we will have to redevelop our 
> whole Apps (6 of them). I still can not believe this? 
>
> I hope someone has a clue about this problem and I'm wondering 
> whether anyone ran into this situation as us.
>
> Best regards,
> ~Ram
>
>
> On Wed, Jul 20, 2022 at 10:44 PM Julio Cojom  wrote:
>
>> Hi Ram,
>>
>> Aditional to all the suggestions, please keep in mind django-filters as 
>> they are important to filter data in your api requests 
>>
>> Regards,
>>
>> Julio Cojom
>>
>> El mié, 20 jul 2022 a las 20:37, Michael Thomas () 
>> escribió:
>>
>>> There's no reason at all that DRF can't be used to do this. Just don't 
>>> use a viewset, as it's not the right fit for this type of thing.
>>> Read through the code for how your current system works, then 
>>> re-implement the relevant parts as DRF ApiView's.
>>>
>>> On Thu, Jul 21, 2022 at 8:43 AM Ram  wrote:
>>>
 Thank you all for quick suggestions. 

 We are stuck with implementing the first API, which is login endpoint. 
 That means since we already developed user registration functionality 
 before without DRF, there seems no way to create a login endpoint so that 
 an existing registered user can login using REST API and access his/her 
 respective data . All we are finding on the web is to create an Abstract 
 user using DRF which requires to change the existing user registration 
 implementation. So I'm wondering whether there is any way to remedify this 
 or are we missing something?

 Best regards,
 ~Ram



 On Tue, Jul 19, 2022 at 6:30 PM Hella thor  
 wrote:

> Hi Ram
> 您可以在原来项目的基础上创建新的APP来单独给移动应用程序来使用,并在整体项目完成以后研究是不是需要DRF来兼容。
>
> Lalit Suthar  于2022年7月19日周二 19:04写道:
>
>> I would also suggest keeping Django views as it is and writing new 
>> views for your APIs 
>> maybe you can create another file named apiviews.py and then write 
>> new APIs with help of your present views
>> refer: https://www.django-rest-framework.org/api-guide/views/
>>
>> On Tue, 19 Jul 2022 at 06:38, Nikhil Chawla  
>> wrote:
>>
>>> Don't clutter the django views with DRF requests. Keep them 
>>> separate, available at, say `api` endpoints.
>>>
>>> On Tue, 19 Jul 2022, 06:17 Michael Thomas,  
>>> wrote:
>>>
 Hey Ram,

 I'm afraid no one can answer your questions without knowing your 
 code, how it works, or anything else...

 Broadly speaking, here's how we approached a similar scenario:

 1) Created one or more Serializer for each model that required 
 interaction via API. Some models required more than one, as they were 
 either too large for list() operations, or required a simpler 
 representation when nested into another Serializer, etc..
 2) Created custom permissions to check if users were allowed to 
 perform the action(s) they were trying to make
 3) Created ViewSets using the permissions and serializers mentioned 
 above, as well as any additional actions that didn't fit within the 
 normal 
 REST verbs
 4) Created a router and registered the viewsets with it
 5) Added the router's urls into the projects url configuration

 I hope that's useful :)

 Kind Regards,
 Michael Thomas  

 On Tue, Jul 19, 2022 at 7:21 AM Ram  wrote:

> Hi,
>
> We completed coding all the features without DRF for our web site 
> and now we are planning to develop a mobile app for the same website 
> by 
> keeping the web site as it is and develop a mobile app using Flutter. 
>
> Based on our understanding, we have do the following in the 
> current code for adding REST APIs
>
>
>1. We have to create serializers.py for each model in each App 
>that we have
>2. We need to add a few lines of code in views.py
>3. We think we don't have to modify the UI template by using 
>json response from DRF ( Is this really necessary because we are 
> not 
>changing anything in the website UI)
>
> Please correct me if I'm wrong about the above 3 points or do we 
> need to do any 

Re: DRF question

2022-07-22 Thread Ram
Hi Thomas & Julio,

Thank you for your answers, but we are shocked to learn that our user
registration functionality has to be rewritten again to create REST APIs.
That means whatever Apps that we developed on User registration have to be
modified too and this further means that we will have to redevelop our
whole Apps (6 of them). I still can not believe this?

I hope someone has a clue about this problem and I'm wondering
whether anyone ran into this situation as us.

Best regards,
~Ram


On Wed, Jul 20, 2022 at 10:44 PM Julio Cojom 
wrote:

> Hi Ram,
>
> Aditional to all the suggestions, please keep in mind django-filters as
> they are important to filter data in your api requests
>
> Regards,
>
> Julio Cojom
>
> El mié, 20 jul 2022 a las 20:37, Michael Thomas (<
> michael.thomas.s...@gmail.com>) escribió:
>
>> There's no reason at all that DRF can't be used to do this. Just don't
>> use a viewset, as it's not the right fit for this type of thing.
>> Read through the code for how your current system works, then
>> re-implement the relevant parts as DRF ApiView's.
>>
>> On Thu, Jul 21, 2022 at 8:43 AM Ram  wrote:
>>
>>> Thank you all for quick suggestions.
>>>
>>> We are stuck with implementing the first API, which is login endpoint.
>>> That means since we already developed user registration functionality
>>> before without DRF, there seems no way to create a login endpoint so that
>>> an existing registered user can login using REST API and access his/her
>>> respective data . All we are finding on the web is to create an Abstract
>>> user using DRF which requires to change the existing user registration
>>> implementation. So I'm wondering whether there is any way to remedify this
>>> or are we missing something?
>>>
>>> Best regards,
>>> ~Ram
>>>
>>>
>>>
>>> On Tue, Jul 19, 2022 at 6:30 PM Hella thor 
>>> wrote:
>>>
 Hi Ram
 您可以在原来项目的基础上创建新的APP来单独给移动应用程序来使用,并在整体项目完成以后研究是不是需要DRF来兼容。

 Lalit Suthar  于2022年7月19日周二 19:04写道:

> I would also suggest keeping Django views as it is and writing new
> views for your APIs
> maybe you can create another file named apiviews.py and then write new
> APIs with help of your present views
> refer: https://www.django-rest-framework.org/api-guide/views/
>
> On Tue, 19 Jul 2022 at 06:38, Nikhil Chawla 
> wrote:
>
>> Don't clutter the django views with DRF requests. Keep them separate,
>> available at, say `api` endpoints.
>>
>> On Tue, 19 Jul 2022, 06:17 Michael Thomas, <
>> michael.thomas.s...@gmail.com> wrote:
>>
>>> Hey Ram,
>>>
>>> I'm afraid no one can answer your questions without knowing your
>>> code, how it works, or anything else...
>>>
>>> Broadly speaking, here's how we approached a similar scenario:
>>>
>>> 1) Created one or more Serializer for each model that required
>>> interaction via API. Some models required more than one, as they were
>>> either too large for list() operations, or required a simpler
>>> representation when nested into another Serializer, etc..
>>> 2) Created custom permissions to check if users were allowed to
>>> perform the action(s) they were trying to make
>>> 3) Created ViewSets using the permissions and serializers mentioned
>>> above, as well as any additional actions that didn't fit within the 
>>> normal
>>> REST verbs
>>> 4) Created a router and registered the viewsets with it
>>> 5) Added the router's urls into the projects url configuration
>>>
>>> I hope that's useful :)
>>>
>>> Kind Regards,
>>> Michael Thomas
>>>
>>> On Tue, Jul 19, 2022 at 7:21 AM Ram  wrote:
>>>
 Hi,

 We completed coding all the features without DRF for our web site
 and now we are planning to develop a mobile app for the same website by
 keeping the web site as it is and develop a mobile app using Flutter.

 Based on our understanding, we have do the following in the current
 code for adding REST APIs


1. We have to create serializers.py for each model in each App
that we have
2. We need to add a few lines of code in views.py
3. We think we don't have to modify the UI template by using
json response from DRF ( Is this really necessary because we are not
changing anything in the website UI)

 Please correct me if I'm wrong about the above 3 points or do we
 need to do any additional things?

 Best regards,
 ~Ram

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it,
 send an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 

Re: DRF question

2022-07-20 Thread Julio Cojom
Hi Ram,

Aditional to all the suggestions, please keep in mind django-filters as
they are important to filter data in your api requests

Regards,

Julio Cojom

El mié, 20 jul 2022 a las 20:37, Michael Thomas (<
michael.thomas.s...@gmail.com>) escribió:

> There's no reason at all that DRF can't be used to do this. Just don't use
> a viewset, as it's not the right fit for this type of thing.
> Read through the code for how your current system works, then re-implement
> the relevant parts as DRF ApiView's.
>
> On Thu, Jul 21, 2022 at 8:43 AM Ram  wrote:
>
>> Thank you all for quick suggestions.
>>
>> We are stuck with implementing the first API, which is login endpoint.
>> That means since we already developed user registration functionality
>> before without DRF, there seems no way to create a login endpoint so that
>> an existing registered user can login using REST API and access his/her
>> respective data . All we are finding on the web is to create an Abstract
>> user using DRF which requires to change the existing user registration
>> implementation. So I'm wondering whether there is any way to remedify this
>> or are we missing something?
>>
>> Best regards,
>> ~Ram
>>
>>
>>
>> On Tue, Jul 19, 2022 at 6:30 PM Hella thor 
>> wrote:
>>
>>> Hi Ram
>>> 您可以在原来项目的基础上创建新的APP来单独给移动应用程序来使用,并在整体项目完成以后研究是不是需要DRF来兼容。
>>>
>>> Lalit Suthar  于2022年7月19日周二 19:04写道:
>>>
 I would also suggest keeping Django views as it is and writing new
 views for your APIs
 maybe you can create another file named apiviews.py and then write new
 APIs with help of your present views
 refer: https://www.django-rest-framework.org/api-guide/views/

 On Tue, 19 Jul 2022 at 06:38, Nikhil Chawla 
 wrote:

> Don't clutter the django views with DRF requests. Keep them separate,
> available at, say `api` endpoints.
>
> On Tue, 19 Jul 2022, 06:17 Michael Thomas, <
> michael.thomas.s...@gmail.com> wrote:
>
>> Hey Ram,
>>
>> I'm afraid no one can answer your questions without knowing your
>> code, how it works, or anything else...
>>
>> Broadly speaking, here's how we approached a similar scenario:
>>
>> 1) Created one or more Serializer for each model that required
>> interaction via API. Some models required more than one, as they were
>> either too large for list() operations, or required a simpler
>> representation when nested into another Serializer, etc..
>> 2) Created custom permissions to check if users were allowed to
>> perform the action(s) they were trying to make
>> 3) Created ViewSets using the permissions and serializers mentioned
>> above, as well as any additional actions that didn't fit within the 
>> normal
>> REST verbs
>> 4) Created a router and registered the viewsets with it
>> 5) Added the router's urls into the projects url configuration
>>
>> I hope that's useful :)
>>
>> Kind Regards,
>> Michael Thomas
>>
>> On Tue, Jul 19, 2022 at 7:21 AM Ram  wrote:
>>
>>> Hi,
>>>
>>> We completed coding all the features without DRF for our web site
>>> and now we are planning to develop a mobile app for the same website by
>>> keeping the web site as it is and develop a mobile app using Flutter.
>>>
>>> Based on our understanding, we have do the following in the current
>>> code for adding REST APIs
>>>
>>>
>>>1. We have to create serializers.py for each model in each App
>>>that we have
>>>2. We need to add a few lines of code in views.py
>>>3. We think we don't have to modify the UI template by using
>>>json response from DRF ( Is this really necessary because we are not
>>>changing anything in the website UI)
>>>
>>> Please correct me if I'm wrong about the above 3 points or do we
>>> need to do any additional things?
>>>
>>> Best regards,
>>> ~Ram
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CA%2BOi5F2wgTLXQFreQp9cXNGBOnTqoAQ6vA5CqZuBNeya%2BWKLXg%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> 

Re: DRF question

2022-07-20 Thread Michael Thomas
There's no reason at all that DRF can't be used to do this. Just don't use
a viewset, as it's not the right fit for this type of thing.
Read through the code for how your current system works, then re-implement
the relevant parts as DRF ApiView's.

On Thu, Jul 21, 2022 at 8:43 AM Ram  wrote:

> Thank you all for quick suggestions.
>
> We are stuck with implementing the first API, which is login endpoint.
> That means since we already developed user registration functionality
> before without DRF, there seems no way to create a login endpoint so that
> an existing registered user can login using REST API and access his/her
> respective data . All we are finding on the web is to create an Abstract
> user using DRF which requires to change the existing user registration
> implementation. So I'm wondering whether there is any way to remedify this
> or are we missing something?
>
> Best regards,
> ~Ram
>
>
>
> On Tue, Jul 19, 2022 at 6:30 PM Hella thor 
> wrote:
>
>> Hi Ram
>> 您可以在原来项目的基础上创建新的APP来单独给移动应用程序来使用,并在整体项目完成以后研究是不是需要DRF来兼容。
>>
>> Lalit Suthar  于2022年7月19日周二 19:04写道:
>>
>>> I would also suggest keeping Django views as it is and writing new views
>>> for your APIs
>>> maybe you can create another file named apiviews.py and then write new
>>> APIs with help of your present views
>>> refer: https://www.django-rest-framework.org/api-guide/views/
>>>
>>> On Tue, 19 Jul 2022 at 06:38, Nikhil Chawla 
>>> wrote:
>>>
 Don't clutter the django views with DRF requests. Keep them separate,
 available at, say `api` endpoints.

 On Tue, 19 Jul 2022, 06:17 Michael Thomas, <
 michael.thomas.s...@gmail.com> wrote:

> Hey Ram,
>
> I'm afraid no one can answer your questions without knowing your code,
> how it works, or anything else...
>
> Broadly speaking, here's how we approached a similar scenario:
>
> 1) Created one or more Serializer for each model that required
> interaction via API. Some models required more than one, as they were
> either too large for list() operations, or required a simpler
> representation when nested into another Serializer, etc..
> 2) Created custom permissions to check if users were allowed to
> perform the action(s) they were trying to make
> 3) Created ViewSets using the permissions and serializers mentioned
> above, as well as any additional actions that didn't fit within the normal
> REST verbs
> 4) Created a router and registered the viewsets with it
> 5) Added the router's urls into the projects url configuration
>
> I hope that's useful :)
>
> Kind Regards,
> Michael Thomas
>
> On Tue, Jul 19, 2022 at 7:21 AM Ram  wrote:
>
>> Hi,
>>
>> We completed coding all the features without DRF for our web site and
>> now we are planning to develop a mobile app for the same website by 
>> keeping
>> the web site as it is and develop a mobile app using Flutter.
>>
>> Based on our understanding, we have do the following in the current
>> code for adding REST APIs
>>
>>
>>1. We have to create serializers.py for each model in each App
>>that we have
>>2. We need to add a few lines of code in views.py
>>3. We think we don't have to modify the UI template by using json
>>response from DRF ( Is this really necessary because we are not 
>> changing
>>anything in the website UI)
>>
>> Please correct me if I'm wrong about the above 3 points or do we need
>> to do any additional things?
>>
>> Best regards,
>> ~Ram
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2BOi5F2wgTLXQFreQp9cXNGBOnTqoAQ6vA5CqZuBNeya%2BWKLXg%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEdx1fo_Zk7H7nFMgUSYkfTC_p_cV8Qa8W17C_GHnDDwdk2eBw%40mail.gmail.com
> 
> .
>
 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop 

Re: DRF question

2022-07-20 Thread Ram
Thank you all for quick suggestions.

We are stuck with implementing the first API, which is login endpoint. That
means since we already developed user registration functionality before
without DRF, there seems no way to create a login endpoint so that an
existing registered user can login using REST API and access his/her
respective data . All we are finding on the web is to create an Abstract
user using DRF which requires to change the existing user registration
implementation. So I'm wondering whether there is any way to remedify this
or are we missing something?

Best regards,
~Ram



On Tue, Jul 19, 2022 at 6:30 PM Hella thor 
wrote:

> Hi Ram
> 您可以在原来项目的基础上创建新的APP来单独给移动应用程序来使用,并在整体项目完成以后研究是不是需要DRF来兼容。
>
> Lalit Suthar  于2022年7月19日周二 19:04写道:
>
>> I would also suggest keeping Django views as it is and writing new views
>> for your APIs
>> maybe you can create another file named apiviews.py and then write new
>> APIs with help of your present views
>> refer: https://www.django-rest-framework.org/api-guide/views/
>>
>> On Tue, 19 Jul 2022 at 06:38, Nikhil Chawla 
>> wrote:
>>
>>> Don't clutter the django views with DRF requests. Keep them separate,
>>> available at, say `api` endpoints.
>>>
>>> On Tue, 19 Jul 2022, 06:17 Michael Thomas, <
>>> michael.thomas.s...@gmail.com> wrote:
>>>
 Hey Ram,

 I'm afraid no one can answer your questions without knowing your code,
 how it works, or anything else...

 Broadly speaking, here's how we approached a similar scenario:

 1) Created one or more Serializer for each model that required
 interaction via API. Some models required more than one, as they were
 either too large for list() operations, or required a simpler
 representation when nested into another Serializer, etc..
 2) Created custom permissions to check if users were allowed to perform
 the action(s) they were trying to make
 3) Created ViewSets using the permissions and serializers mentioned
 above, as well as any additional actions that didn't fit within the normal
 REST verbs
 4) Created a router and registered the viewsets with it
 5) Added the router's urls into the projects url configuration

 I hope that's useful :)

 Kind Regards,
 Michael Thomas

 On Tue, Jul 19, 2022 at 7:21 AM Ram  wrote:

> Hi,
>
> We completed coding all the features without DRF for our web site and
> now we are planning to develop a mobile app for the same website by 
> keeping
> the web site as it is and develop a mobile app using Flutter.
>
> Based on our understanding, we have do the following in the current
> code for adding REST APIs
>
>
>1. We have to create serializers.py for each model in each App
>that we have
>2. We need to add a few lines of code in views.py
>3. We think we don't have to modify the UI template by using json
>response from DRF ( Is this really necessary because we are not 
> changing
>anything in the website UI)
>
> Please correct me if I'm wrong about the above 3 points or do we need
> to do any additional things?
>
> Best regards,
> ~Ram
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BOi5F2wgTLXQFreQp9cXNGBOnTqoAQ6vA5CqZuBNeya%2BWKLXg%40mail.gmail.com
> 
> .
>
 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAEdx1fo_Zk7H7nFMgUSYkfTC_p_cV8Qa8W17C_GHnDDwdk2eBw%40mail.gmail.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAEO4UakHjqtO3S-DZ-9A_-C7ZMoEBiNxtGm1eGL-R1cp9Ofutw%40mail.gmail.com
>>> 
>>> .
>>>
>> --

Re: DRF question

2022-07-19 Thread Hella thor
Hi Ram
您可以在原来项目的基础上创建新的APP来单独给移动应用程序来使用,并在整体项目完成以后研究是不是需要DRF来兼容。

Lalit Suthar  于2022年7月19日周二 19:04写道:

> I would also suggest keeping Django views as it is and writing new views
> for your APIs
> maybe you can create another file named apiviews.py and then write new
> APIs with help of your present views
> refer: https://www.django-rest-framework.org/api-guide/views/
>
> On Tue, 19 Jul 2022 at 06:38, Nikhil Chawla 
> wrote:
>
>> Don't clutter the django views with DRF requests. Keep them separate,
>> available at, say `api` endpoints.
>>
>> On Tue, 19 Jul 2022, 06:17 Michael Thomas, 
>> wrote:
>>
>>> Hey Ram,
>>>
>>> I'm afraid no one can answer your questions without knowing your code,
>>> how it works, or anything else...
>>>
>>> Broadly speaking, here's how we approached a similar scenario:
>>>
>>> 1) Created one or more Serializer for each model that required
>>> interaction via API. Some models required more than one, as they were
>>> either too large for list() operations, or required a simpler
>>> representation when nested into another Serializer, etc..
>>> 2) Created custom permissions to check if users were allowed to perform
>>> the action(s) they were trying to make
>>> 3) Created ViewSets using the permissions and serializers mentioned
>>> above, as well as any additional actions that didn't fit within the normal
>>> REST verbs
>>> 4) Created a router and registered the viewsets with it
>>> 5) Added the router's urls into the projects url configuration
>>>
>>> I hope that's useful :)
>>>
>>> Kind Regards,
>>> Michael Thomas
>>>
>>> On Tue, Jul 19, 2022 at 7:21 AM Ram  wrote:
>>>
 Hi,

 We completed coding all the features without DRF for our web site and
 now we are planning to develop a mobile app for the same website by keeping
 the web site as it is and develop a mobile app using Flutter.

 Based on our understanding, we have do the following in the current
 code for adding REST APIs


1. We have to create serializers.py for each model in each App that
we have
2. We need to add a few lines of code in views.py
3. We think we don't have to modify the UI template by using json
response from DRF ( Is this really necessary because we are not changing
anything in the website UI)

 Please correct me if I'm wrong about the above 3 points or do we need
 to do any additional things?

 Best regards,
 ~Ram

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CA%2BOi5F2wgTLXQFreQp9cXNGBOnTqoAQ6vA5CqZuBNeya%2BWKLXg%40mail.gmail.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAEdx1fo_Zk7H7nFMgUSYkfTC_p_cV8Qa8W17C_GHnDDwdk2eBw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAEO4UakHjqtO3S-DZ-9A_-C7ZMoEBiNxtGm1eGL-R1cp9Ofutw%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGp2JVHC8SFuiJ7g7pnb4xEZz70O1-auE%3DUr0NGGG4AamJNUzw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this 

Re: DRF question

2022-07-19 Thread Lalit Suthar
I would also suggest keeping Django views as it is and writing new views
for your APIs
maybe you can create another file named apiviews.py and then write new APIs
with help of your present views
refer: https://www.django-rest-framework.org/api-guide/views/

On Tue, 19 Jul 2022 at 06:38, Nikhil Chawla 
wrote:

> Don't clutter the django views with DRF requests. Keep them separate,
> available at, say `api` endpoints.
>
> On Tue, 19 Jul 2022, 06:17 Michael Thomas, 
> wrote:
>
>> Hey Ram,
>>
>> I'm afraid no one can answer your questions without knowing your code,
>> how it works, or anything else...
>>
>> Broadly speaking, here's how we approached a similar scenario:
>>
>> 1) Created one or more Serializer for each model that required
>> interaction via API. Some models required more than one, as they were
>> either too large for list() operations, or required a simpler
>> representation when nested into another Serializer, etc..
>> 2) Created custom permissions to check if users were allowed to perform
>> the action(s) they were trying to make
>> 3) Created ViewSets using the permissions and serializers mentioned
>> above, as well as any additional actions that didn't fit within the normal
>> REST verbs
>> 4) Created a router and registered the viewsets with it
>> 5) Added the router's urls into the projects url configuration
>>
>> I hope that's useful :)
>>
>> Kind Regards,
>> Michael Thomas
>>
>> On Tue, Jul 19, 2022 at 7:21 AM Ram  wrote:
>>
>>> Hi,
>>>
>>> We completed coding all the features without DRF for our web site and
>>> now we are planning to develop a mobile app for the same website by keeping
>>> the web site as it is and develop a mobile app using Flutter.
>>>
>>> Based on our understanding, we have do the following in the current code
>>> for adding REST APIs
>>>
>>>
>>>1. We have to create serializers.py for each model in each App that
>>>we have
>>>2. We need to add a few lines of code in views.py
>>>3. We think we don't have to modify the UI template by using json
>>>response from DRF ( Is this really necessary because we are not changing
>>>anything in the website UI)
>>>
>>> Please correct me if I'm wrong about the above 3 points or do we need to
>>> do any additional things?
>>>
>>> Best regards,
>>> ~Ram
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CA%2BOi5F2wgTLXQFreQp9cXNGBOnTqoAQ6vA5CqZuBNeya%2BWKLXg%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAEdx1fo_Zk7H7nFMgUSYkfTC_p_cV8Qa8W17C_GHnDDwdk2eBw%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEO4UakHjqtO3S-DZ-9A_-C7ZMoEBiNxtGm1eGL-R1cp9Ofutw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHC8SFuiJ7g7pnb4xEZz70O1-auE%3DUr0NGGG4AamJNUzw%40mail.gmail.com.


Re: DRF question

2022-07-18 Thread Nikhil Chawla
1. Serializers.py for each model.
2. Maybe create separate DRF views that parse and render JSON, and avoid 
cluttering pure Django views.
3. Keep the website UI as is.

On Tuesday, July 19, 2022 at 5:52:19 AM UTC+5:30 ram.mu...@gmail.com wrote:

> Hi,
>
> We completed coding all the features without DRF for our web site and now 
> we are planning to develop a mobile app for the same website by keeping the 
> web site as it is and develop a mobile app using Flutter. 
>
> Based on our understanding, we have do the following in the current code 
> for adding REST APIs
>
>
>1. We have to create serializers.py for each model in each App that we 
>have
>2. We need to add a few lines of code in views.py
>3. We think we don't have to modify the UI template by using json 
>response from DRF ( Is this really necessary because we are not changing 
>anything in the website UI)
>
> Please correct me if I'm wrong about the above 3 points or do we need to 
> do any additional things?
>
> Best regards,
> ~Ram
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e6c7f5dd-bb17-423a-a04f-533b31d3a787n%40googlegroups.com.


Re: DRF question

2022-07-18 Thread Nikhil Chawla
Don't clutter the django views with DRF requests. Keep them separate,
available at, say `api` endpoints.

On Tue, 19 Jul 2022, 06:17 Michael Thomas, 
wrote:

> Hey Ram,
>
> I'm afraid no one can answer your questions without knowing your code, how
> it works, or anything else...
>
> Broadly speaking, here's how we approached a similar scenario:
>
> 1) Created one or more Serializer for each model that required interaction
> via API. Some models required more than one, as they were either too large
> for list() operations, or required a simpler representation when nested
> into another Serializer, etc..
> 2) Created custom permissions to check if users were allowed to perform
> the action(s) they were trying to make
> 3) Created ViewSets using the permissions and serializers mentioned above,
> as well as any additional actions that didn't fit within the normal REST
> verbs
> 4) Created a router and registered the viewsets with it
> 5) Added the router's urls into the projects url configuration
>
> I hope that's useful :)
>
> Kind Regards,
> Michael Thomas
>
> On Tue, Jul 19, 2022 at 7:21 AM Ram  wrote:
>
>> Hi,
>>
>> We completed coding all the features without DRF for our web site and now
>> we are planning to develop a mobile app for the same website by keeping the
>> web site as it is and develop a mobile app using Flutter.
>>
>> Based on our understanding, we have do the following in the current code
>> for adding REST APIs
>>
>>
>>1. We have to create serializers.py for each model in each App that
>>we have
>>2. We need to add a few lines of code in views.py
>>3. We think we don't have to modify the UI template by using json
>>response from DRF ( Is this really necessary because we are not changing
>>anything in the website UI)
>>
>> Please correct me if I'm wrong about the above 3 points or do we need to
>> do any additional things?
>>
>> Best regards,
>> ~Ram
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2BOi5F2wgTLXQFreQp9cXNGBOnTqoAQ6vA5CqZuBNeya%2BWKLXg%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEdx1fo_Zk7H7nFMgUSYkfTC_p_cV8Qa8W17C_GHnDDwdk2eBw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEO4UakHjqtO3S-DZ-9A_-C7ZMoEBiNxtGm1eGL-R1cp9Ofutw%40mail.gmail.com.


Re: DRF question

2022-07-18 Thread Ram
Hi Thomas,

Thank you very much for your quick response. I think you understand my
requirements. I'm basically trying to know what needs to be done in DRF
implementation for developing a mobile app using Flutter when my website is
still using existing UI and also without changing any functionality.

Best regards,
~Ram

On Mon, Jul 18, 2022 at 6:47 PM Michael Thomas <
michael.thomas.s...@gmail.com> wrote:

> Hey Ram,
>
> I'm afraid no one can answer your questions without knowing your code, how
> it works, or anything else...
>
> Broadly speaking, here's how we approached a similar scenario:
>
> 1) Created one or more Serializer for each model that required interaction
> via API. Some models required more than one, as they were either too large
> for list() operations, or required a simpler representation when nested
> into another Serializer, etc..
> 2) Created custom permissions to check if users were allowed to perform
> the action(s) they were trying to make
> 3) Created ViewSets using the permissions and serializers mentioned above,
> as well as any additional actions that didn't fit within the normal REST
> verbs
> 4) Created a router and registered the viewsets with it
> 5) Added the router's urls into the projects url configuration
>
> I hope that's useful :)
>
> Kind Regards,
> Michael Thomas
>
> On Tue, Jul 19, 2022 at 7:21 AM Ram  wrote:
>
>> Hi,
>>
>> We completed coding all the features without DRF for our web site and now
>> we are planning to develop a mobile app for the same website by keeping the
>> web site as it is and develop a mobile app using Flutter.
>>
>> Based on our understanding, we have do the following in the current code
>> for adding REST APIs
>>
>>
>>1. We have to create serializers.py for each model in each App that
>>we have
>>2. We need to add a few lines of code in views.py
>>3. We think we don't have to modify the UI template by using json
>>response from DRF ( Is this really necessary because we are not changing
>>anything in the website UI)
>>
>> Please correct me if I'm wrong about the above 3 points or do we need to
>> do any additional things?
>>
>> Best regards,
>> ~Ram
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2BOi5F2wgTLXQFreQp9cXNGBOnTqoAQ6vA5CqZuBNeya%2BWKLXg%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEdx1fo_Zk7H7nFMgUSYkfTC_p_cV8Qa8W17C_GHnDDwdk2eBw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BOi5F2eVZbo4vj54XLErcEGbwU0%3DSawr-DQLj0H8Dej7J6NDQ%40mail.gmail.com.


Re: DRF question

2022-07-18 Thread Michael Thomas
Hey Ram,

I'm afraid no one can answer your questions without knowing your code, how
it works, or anything else...

Broadly speaking, here's how we approached a similar scenario:

1) Created one or more Serializer for each model that required interaction
via API. Some models required more than one, as they were either too large
for list() operations, or required a simpler representation when nested
into another Serializer, etc..
2) Created custom permissions to check if users were allowed to perform the
action(s) they were trying to make
3) Created ViewSets using the permissions and serializers mentioned above,
as well as any additional actions that didn't fit within the normal REST
verbs
4) Created a router and registered the viewsets with it
5) Added the router's urls into the projects url configuration

I hope that's useful :)

Kind Regards,
Michael Thomas

On Tue, Jul 19, 2022 at 7:21 AM Ram  wrote:

> Hi,
>
> We completed coding all the features without DRF for our web site and now
> we are planning to develop a mobile app for the same website by keeping the
> web site as it is and develop a mobile app using Flutter.
>
> Based on our understanding, we have do the following in the current code
> for adding REST APIs
>
>
>1. We have to create serializers.py for each model in each App that we
>have
>2. We need to add a few lines of code in views.py
>3. We think we don't have to modify the UI template by using json
>response from DRF ( Is this really necessary because we are not changing
>anything in the website UI)
>
> Please correct me if I'm wrong about the above 3 points or do we need to
> do any additional things?
>
> Best regards,
> ~Ram
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BOi5F2wgTLXQFreQp9cXNGBOnTqoAQ6vA5CqZuBNeya%2BWKLXg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEdx1fo_Zk7H7nFMgUSYkfTC_p_cV8Qa8W17C_GHnDDwdk2eBw%40mail.gmail.com.


DRF question

2022-07-18 Thread Ram
Hi,

We completed coding all the features without DRF for our web site and now
we are planning to develop a mobile app for the same website by keeping the
web site as it is and develop a mobile app using Flutter.

Based on our understanding, we have do the following in the current code
for adding REST APIs


   1. We have to create serializers.py for each model in each App that we
   have
   2. We need to add a few lines of code in views.py
   3. We think we don't have to modify the UI template by using json
   response from DRF ( Is this really necessary because we are not changing
   anything in the website UI)

Please correct me if I'm wrong about the above 3 points or do we need to do
any additional things?

Best regards,
~Ram

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BOi5F2wgTLXQFreQp9cXNGBOnTqoAQ6vA5CqZuBNeya%2BWKLXg%40mail.gmail.com.