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 <gupt...@gmail.com 
> <javascript:>> 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 <javascript:>.
>> To post to this group, send email to django...@googlegroups.com 
>> <javascript:>.
>> 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
>>  
>> <https://groups.google.com/d/msgid/django-users/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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.

Reply via email to