how to use placeholder in model based form

On Wed, 21 Nov 2018 at 19:56, Pradeep Singh <[email protected]> wrote:

> how to use place in model based form
>
> On Wed, 21 Nov 2018 at 19:08, Saurabh Agrawal <[email protected]>
> wrote:
>
>> I am sorry, maybe I am understanding wrong, but isn't log as expected?
>>
>> Since the signal is run synchronously within the Django request, "POST
>> /adminapp/merchantstores/add/" gets logged, only after the signal has
>> finished running.
>>
>> On Wed, Nov 21, 2018 at 6:55 PM Yavin Aalto Arba <[email protected]>
>> wrote:
>>
>>> if created is true it means that the signal is being sent AFTER the
>>> instance was saved(I am assuming this is a new object and not an update!)
>>>
>>> weird.
>>>
>>> ...what happens when you manually do
>>> an MerchantStores.objects.create(...) call with all the mandatory details?
>>>
>>> On Wed, 21 Nov 2018 at 12:33, prateek gupta <[email protected]> wrote:
>>>
>>>> I just printed the value of created as
>>>>
>>>> kwargs.get("created")
>>>>
>>>>
>>>> And it''s vaulue is True.
>>>>
>>>> On Wednesday, November 21, 2018 at 3:19:56 PM UTC+5:30, Yavin Aalto
>>>> Arba wrote:
>>>>>
>>>>> Something doesn't add up. Can you check the ["created"] keyword? What
>>>>> does it say?
>>>>>
>>>>> On Wed, 21 Nov 2018 at 11:26, prateek gupta <[email protected]> wrote:
>>>>>
>>>>>> @Yavin Aalto Arba
>>>>>>
>>>>>> I am using models.py, admin.py for my view, no any customized forms
>>>>>> or view.
>>>>>>
>>>>>> [image: screen_3.JPG]
>>>>>>
>>>>>> [image: screen_2.JPG]
>>>>>>
>>>>>> [image: screen_1.JPG]
>>>>>> PFA screen shot for the same.
>>>>>>
>>>>>> On Wednesday, November 21, 2018 at 2:46:41 PM UTC+5:30, Yavin Aalto
>>>>>> Arba wrote:
>>>>>>>
>>>>>>> Can you show us the view where the save() is invoked?
>>>>>>>
>>>>>>> On Wed, 21 Nov 2018 at 10:57, prateek gupta <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi All,
>>>>>>>>
>>>>>>>> I have an admin panel built on Django 2.0.6, Mysql 5.7 and Python
>>>>>>>> 3.6.
>>>>>>>>
>>>>>>>> Now I have written following signal code in signals.py-
>>>>>>>> from .models import MerchantStores
>>>>>>>> from django.db.models.signals import post_save
>>>>>>>> from django.dispatch import receiver
>>>>>>>>
>>>>>>>> @receiver(post_save, sender = MerchantStores, weak=False)
>>>>>>>> def ensure_store_id_exists(sender, **kwargs):
>>>>>>>>    print ("check fucntion")
>>>>>>>>    ex = kwargs.get("instance").store_id
>>>>>>>>    print ("store id:",ex)
>>>>>>>>    import requests
>>>>>>>>    URL = "http://example.cloud/rmsservice/resetPin?storeId=
>>>>>>>> "+str(ex)
>>>>>>>>    print("url:",URL)
>>>>>>>>    data = {'Content-Type': 'application/json',
>>>>>>>>            'app-id': 'APP_ID',
>>>>>>>>            'secret-key': 'SECRET_KEY',
>>>>>>>>            'aid': 'PG'}
>>>>>>>>
>>>>>>>>    r = requests.post(url=URL, headers=data)
>>>>>>>>    response_text = r.text
>>>>>>>>    print(response_text)
>>>>>>>>
>>>>>>>> And in apps.py I have done following settings-
>>>>>>>>
>>>>>>>> from django.apps import AppConfig
>>>>>>>>
>>>>>>>> class AdminappConfig(AppConfig):
>>>>>>>>     name = 'adminapp'
>>>>>>>>
>>>>>>>>     def ready(self):
>>>>>>>>         import adminapp.signals
>>>>>>>>
>>>>>>>>
>>>>>>>> In above signals I am sending a post request to resetPin api.
>>>>>>>> I need to send the request once form is saved but my signal is
>>>>>>>> posting request before the save method.
>>>>>>>> I confirmed the above from server logs. Following is the logs I am
>>>>>>>> getting-
>>>>>>>> [21/Nov/2018 14:18:03] "GET /jsi18n/ HTTP/1.1" 200 3185
>>>>>>>> check fucntion
>>>>>>>> store id: 1533
>>>>>>>> url: http://example/rmsservice/resetPin?storeId=1533
>>>>>>>> {"success":false,"code":"8050","message":"Merchant not
>>>>>>>> active","response":null}
>>>>>>>> [21/Nov/2018 14:18:29] "POST /adminapp/merchantstores/add/
>>>>>>>> HTTP/1.1" 302 0
>>>>>>>> [21/Nov/2018 14:18:32] "GET /adminapp/merchantstores/ HTTP/1.1" 200
>>>>>>>> 12659
>>>>>>>> [21/Nov/2018 14:18:34] "GET /jsi18n/ HTTP/1.1" 200 3185
>>>>>>>>
>>>>>>>> As per above log, my signal is invoked before teh save() method but
>>>>>>>> it should be after the save() method.
>>>>>>>> Can anyone please help my to find out what I am doing wrong here?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Prateek
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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 [email protected].
>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>> 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/9edd586b-604b-4734-ab1d-28f7fda9d527%40googlegroups.com
>>>>>>>> <https://groups.google.com/d/msgid/django-users/9edd586b-604b-4734-ab1d-28f7fda9d527%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 [email protected].
>>>>>> To post to this group, send email to [email protected].
>>>>>> 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/92aa3ade-9525-4f99-a85f-aef4c57172ba%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/django-users/92aa3ade-9525-4f99-a85f-aef4c57172ba%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 [email protected].
>>>> To post to this group, send email to [email protected].
>>>> 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/9f6d3cc5-3976-4278-bd1e-be086a8c9d7d%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/9f6d3cc5-3976-4278-bd1e-be086a8c9d7d%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 [email protected].
>>> To post to this group, send email to [email protected].
>>> 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-ZUrgHW7WoVMJ1zHV1j3fDOq16V0n%2BM2NOXjVZiixT8Zng%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CA%2B%2Be-ZUrgHW7WoVMJ1zHV1j3fDOq16V0n%2BM2NOXjVZiixT8Zng%40mail.gmail.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 [email protected].
>> To post to this group, send email to [email protected].
>> 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/CAL1UH0vAqtzQB7DCE3Sx_BqRRtNgKjXvMAn33F2Aa8J%2BaQQEsw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAL1UH0vAqtzQB7DCE3Sx_BqRRtNgKjXvMAn33F2Aa8J%2BaQQEsw%40mail.gmail.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 [email protected].
To post to this group, send email to [email protected].
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/CANwgZcY9H_ToFq_Or6fiRrHJKWvXdFTNhaBkhJ4yP5YfMeThvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to