Re: Approach to implement a Rest call functionality

2018-11-20 Thread Yavin Aalto Arba
Hi Prateek,

I think your best option is using javascript on the front end - leveraging
an ajax post call.

On Tue, 20 Nov 2018 at 13:24, prateek gupta  wrote:

> Hi All,
>
> I have an admin panel built on Django 2.0.6, MySql 5.7 and Python 3.6.
>
> In this panel I have a field 'PIN' described in models.py like below-
> class MerchantStores(models.Model):
> store_id = models.AutoField(primary_key=True)
> pin = models.CharField(unique=True, max_length=45, blank=True,
> null=True)
>
> Currently admin has to fill manually this Pin.
>
> Now, I have to change this PIN text box to a button and on click of this
> button a post request will be sent to an api.
> This button will be enabled once admin will edit the form (since Pin
> generation required store id and a store id will be generated only after
> first creating a new store)
>
> The end point of this api will contain the store_id at the end and will
> have some required input parameters like api id etc.
>
> Since this api itself saves the new Pin in database , so I don't need to
> save this field myself. I just need to show a button and on click this
> button make a call to api.
>
> So for this requirement I am going to use Django Rest Framework but before
> that I need your suggestion to implement it with a better way.
> Please suggest me how can I make a button field instead of text,then  how
> can I append the store_id to the end point and post my request to the api
> successfully?
>
> Thanks,
> Prateek Gupta
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%2Be-ZVeBUEKkbgv9VDjA0ZSPJHR%2BtZ%2BNXCNWT2d_XRKVzUG3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Approach to implement a Rest call functionality

2018-11-20 Thread MTS BOUR
I didn't really understand what you mean, why not use method Post in a
boutton in an Html form ?

Le mar. 20 nov. 2018 à 12:24, prateek gupta  a écrit :

> Hi All,
>
> I have an admin panel built on Django 2.0.6, MySql 5.7 and Python 3.6.
>
> In this panel I have a field 'PIN' described in models.py like below-
> class MerchantStores(models.Model):
> store_id = models.AutoField(primary_key=True)
> pin = models.CharField(unique=True, max_length=45, blank=True,
> null=True)
>
> Currently admin has to fill manually this Pin.
>
> Now, I have to change this PIN text box to a button and on click of this
> button a post request will be sent to an api.
> This button will be enabled once admin will edit the form (since Pin
> generation required store id and a store id will be generated only after
> first creating a new store)
>
> The end point of this api will contain the store_id at the end and will
> have some required input parameters like api id etc.
>
> Since this api itself saves the new Pin in database , so I don't need to
> save this field myself. I just need to show a button and on click this
> button make a call to api.
>
> So for this requirement I am going to use Django Rest Framework but before
> that I need your suggestion to implement it with a better way.
> Please suggest me how can I make a button field instead of text,then  how
> can I append the store_id to the end point and post my request to the api
> successfully?
>
> Thanks,
> Prateek Gupta
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAq3G-G-k-Mz3iD5uFvgPxmbmVC5jM1LzxC9BPrCYgzTJSTXqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Approach to implement a Rest call functionality

2018-11-20 Thread prateek gupta
Thanks @Yavin for your suggestion.
I thought I will have to use Django Rest Framework for this functionality, 
never thought that from front end I can do that :)

On Tuesday, November 20, 2018 at 5:17:35 PM UTC+5:30, Yavin Aalto Arba 
wrote:
>
> Hi Prateek,
>
> I think your best option is using javascript on the front end - leveraging 
> an ajax post call.
>
> On Tue, 20 Nov 2018 at 13:24, prateek gupta  > wrote:
>
>> Hi All,
>>
>> I have an admin panel built on Django 2.0.6, MySql 5.7 and Python 3.6.
>>
>> In this panel I have a field 'PIN' described in models.py like below-
>> class MerchantStores(models.Model):
>> store_id = models.AutoField(primary_key=True)
>> pin = models.CharField(unique=True, max_length=45, blank=True, 
>> null=True)
>>
>> Currently admin has to fill manually this Pin.
>>
>> Now, I have to change this PIN text box to a button and on click of this 
>> button a post request will be sent to an api.
>> This button will be enabled once admin will edit the form (since Pin 
>> generation required store id and a store id will be generated only after 
>> first creating a new store)
>>
>> The end point of this api will contain the store_id at the end and will 
>> have some required input parameters like api id etc.
>>
>> Since this api itself saves the new Pin in database , so I don't need to 
>> save this field myself. I just need to show a button and on click this 
>> button make a call to api.
>>
>> So for this requirement I am going to use Django Rest Framework but 
>> before that I need your suggestion to implement it with a better way.
>> Please suggest me how can I make a button field instead of text,then  how 
>> can I append the store_id to the end point and post my request to the api 
>> successfully?
>>
>> Thanks,
>> Prateek Gupta
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e9b96409-90c8-41e6-9da1-d3645e92a9ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Approach to implement a Rest call functionality

2018-11-20 Thread Yavin Aalto Arba
Not sure if we're a bit confused on the use case here. REST framework is a
server side platform which can help you implement apis fast, it's a good
idea to use if you don't have an endpoint and want fast CRUD
implementation. As for having a button on the client side - you can use
HTML forms or ajax etc. I think JS\Ajax is the way to go since you can
extract stuff from the document with greater ease and send it away to an
endpoint.

On Tue, 20 Nov 2018 at 14:09, prateek gupta  wrote:

> Thanks @Yavin for your suggestion.
> I thought I will have to use Django Rest Framework for this functionality,
> never thought that from front end I can do that :)
>
> On Tuesday, November 20, 2018 at 5:17:35 PM UTC+5:30, Yavin Aalto Arba
> wrote:
>>
>> Hi Prateek,
>>
>> I think your best option is using javascript on the front end -
>> leveraging an ajax post call.
>>
>> On Tue, 20 Nov 2018 at 13:24, prateek gupta  wrote:
>>
>>> Hi All,
>>>
>>> I have an admin panel built on Django 2.0.6, MySql 5.7 and Python 3.6.
>>>
>>> In this panel I have a field 'PIN' described in models.py like below-
>>> class MerchantStores(models.Model):
>>> store_id = models.AutoField(primary_key=True)
>>> pin = models.CharField(unique=True, max_length=45, blank=True,
>>> null=True)
>>>
>>> Currently admin has to fill manually this Pin.
>>>
>>> Now, I have to change this PIN text box to a button and on click of this
>>> button a post request will be sent to an api.
>>> This button will be enabled once admin will edit the form (since Pin
>>> generation required store id and a store id will be generated only after
>>> first creating a new store)
>>>
>>> The end point of this api will contain the store_id at the end and will
>>> have some required input parameters like api id etc.
>>>
>>> Since this api itself saves the new Pin in database , so I don't need to
>>> save this field myself. I just need to show a button and on click this
>>> button make a call to api.
>>>
>>> So for this requirement I am going to use Django Rest Framework but
>>> before that I need your suggestion to implement it with a better way.
>>> Please suggest me how can I make a button field instead of text,then
>>> how can I append the store_id to the end point and post my request to the
>>> api successfully?
>>>
>>> Thanks,
>>> Prateek Gupta
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e9b96409-90c8-41e6-9da1-d3645e92a9ad%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%2Be-ZX2dW7UFhQ7VSOV4n%2BqRcdQ%3DPyd6mCgs_66YVdT2UqN6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Approach to implement a Rest call functionality

2018-11-20 Thread prateek gupta
Hi @MTS S BOUR,
I am not using forms.pr currently. These forms fields are from models.py 
only.
That's I w had not thought about html form.

On Tuesday, November 20, 2018 at 5:18:54 PM UTC+5:30, MTS BOUR wrote:
>
> I didn't really understand what you mean, why not use method Post in a 
> boutton in an Html form ?
>
> Le mar. 20 nov. 2018 à 12:24, prateek gupta  > a écrit :
>
>> Hi All,
>>
>> I have an admin panel built on Django 2.0.6, MySql 5.7 and Python 3.6.
>>
>> In this panel I have a field 'PIN' described in models.py like below-
>> class MerchantStores(models.Model):
>> store_id = models.AutoField(primary_key=True)
>> pin = models.CharField(unique=True, max_length=45, blank=True, 
>> null=True)
>>
>> Currently admin has to fill manually this Pin.
>>
>> Now, I have to change this PIN text box to a button and on click of this 
>> button a post request will be sent to an api.
>> This button will be enabled once admin will edit the form (since Pin 
>> generation required store id and a store id will be generated only after 
>> first creating a new store)
>>
>> The end point of this api will contain the store_id at the end and will 
>> have some required input parameters like api id etc.
>>
>> Since this api itself saves the new Pin in database , so I don't need to 
>> save this field myself. I just need to show a button and on click this 
>> button make a call to api.
>>
>> So for this requirement I am going to use Django Rest Framework but 
>> before that I need your suggestion to implement it with a better way.
>> Please suggest me how can I make a button field instead of text,then  how 
>> can I append the store_id to the end point and post my request to the api 
>> successfully?
>>
>> Thanks,
>> Prateek Gupta
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a3af9b7a-a127-4821-ac97-4f057251505b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Approach to implement a Rest call functionality

2018-11-20 Thread prateek gupta
Got it, I will try to do the same.

On Tuesday, November 20, 2018 at 6:12:20 PM UTC+5:30, Yavin Aalto Arba 
wrote:
>
> Not sure if we're a bit confused on the use case here. REST framework is a 
> server side platform which can help you implement apis fast, it's a good 
> idea to use if you don't have an endpoint and want fast CRUD 
> implementation. As for having a button on the client side - you can use 
> HTML forms or ajax etc. I think JS\Ajax is the way to go since you can 
> extract stuff from the document with greater ease and send it away to an 
> endpoint. 
>
> On Tue, 20 Nov 2018 at 14:09, prateek gupta  > wrote:
>
>> Thanks @Yavin for your suggestion.
>> I thought I will have to use Django Rest Framework for this 
>> functionality, never thought that from front end I can do that :)
>>
>> On Tuesday, November 20, 2018 at 5:17:35 PM UTC+5:30, Yavin Aalto Arba 
>> wrote:
>>>
>>> Hi Prateek,
>>>
>>> I think your best option is using javascript on the front end - 
>>> leveraging an ajax post call.
>>>
>>> On Tue, 20 Nov 2018 at 13:24, prateek gupta  wrote:
>>>
 Hi All,

 I have an admin panel built on Django 2.0.6, MySql 5.7 and Python 3.6.

 In this panel I have a field 'PIN' described in models.py like below-
 class MerchantStores(models.Model):
 store_id = models.AutoField(primary_key=True)
 pin = models.CharField(unique=True, max_length=45, blank=True, 
 null=True)

 Currently admin has to fill manually this Pin.

 Now, I have to change this PIN text box to a button and on click of 
 this button a post request will be sent to an api.
 This button will be enabled once admin will edit the form (since Pin 
 generation required store id and a store id will be generated only after 
 first creating a new store)

 The end point of this api will contain the store_id at the end and will 
 have some required input parameters like api id etc.

 Since this api itself saves the new Pin in database , so I don't need 
 to save this field myself. I just need to show a button and on click this 
 button make a call to api.

 So for this requirement I am going to use Django Rest Framework but 
 before that I need your suggestion to implement it with a better way.
 Please suggest me how can I make a button field instead of text,then  
 how can I append the store_id to the end point and post my request to the 
 api successfully?

 Thanks,
 Prateek Gupta

 -- 
 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...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/e9b96409-90c8-41e6-9da1-d3645e92a9ad%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5b0d4f79-35b0-42c1-aa32-ec5b4d19f2b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.