The idea of doing a POST request during template rendering seems weird. As 
others have mentioned - that's not the place for it. 

But perhaps you issue could be a matter of performing your POST operation 
on the client side, instead of the django server? In that case, it might be 
worth investigating if you could code in some JS inside your template so 
that when the client's browser loads it, the POST operation is called and 
changes are made appropriately on the site. 

Yours,
Abraham V.


On Saturday, 10 September 2016 23:15:28 UTC+5:30, Al Johri wrote:
>
> I'm experimenting with creating templates out of subtemplates. These 
> subtemplates can be either (a) simple text or (b) a hash representing a 
> sentence (i.e. {subject: "Dog", verb: "eat", object: "my {{var}}", tense: 
> "past"}). I would like to run the hashes through a realization engine which 
> would render as "Dog ate my homework" given a context dictionary of {var: 
> "homework"}. The realization engine is accessed via a REST API.
>
> Does that make sense?
>
> On Friday, September 2, 2016 at 1:38:39 AM UTC-4, Constantine Covtushenko 
> wrote:
>>
>> Hi All,
>> There is no valuable reason to do it in the template. And no matter how 
>> to ate using it, cause template should only present view model(s).
>>
>> But if you tell us your intention may be we can suggest a better place 
>> for such request?
>>
>> Regards,
>>
>> On Sep 2, 2016 6:03 AM, "Al Johri" <al.j...@gmail.com> wrote:
>>
>>> Ludovic,
>>>
>>> I'm using the templates for a different purpose, not in a web framework 
>>> or view.
>>>
>>> Thanks,
>>>
>>> Al
>>>
>>> On Thursday, September 1, 2016 at 8:09:29 AM UTC-4, ludovic coues wrote:
>>>>
>>>> I wouldn't do it this way. 
>>>> Personally, I would make the POST request in the view function, put 
>>>> the return value in the context. The template isn't a good place to 
>>>> have logic. It should only take data and format them. 
>>>>
>>>> 2016-09-01 5:33 GMT+02:00 Al Johri <al.j...@gmail.com>: 
>>>> > Hi Django Users, 
>>>> > 
>>>> > I want to make a custom template tag where the tag's renderer needs 
>>>> to make 
>>>> > a POST request. 
>>>> > 
>>>> > 
>>>> https://docs.djangoproject.com/en/1.10/howto/custom-template-tags/#writing-the-renderer
>>>>  
>>>> > 
>>>> https://docs.djangoproject.com/en/1.10/howto/custom-template-tags/#thread-safety-considerations
>>>>  
>>>> > 
>>>> > Is it possible to render the nodes of a template in multiple threads? 
>>>> I 
>>>> > would ideally like those POST requests to happen at the same time. 
>>>> > 
>>>> > Does anyone know of some similar project? 
>>>> > 
>>>> > Thanks, 
>>>> > 
>>>> > Al 
>>>> > 
>>>> > -- 
>>>> > 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/84ccc6dc-ae1d-404c-9a05-1b72fc36a778%40googlegroups.com.
>>>>  
>>>>
>>>> > For more options, visit https://groups.google.com/d/optout. 
>>>>
>>>>
>>>>
>>>> -- 
>>>>
>>>> Cordialement, Coues Ludovic 
>>>> +336 148 743 42 
>>>>
>>> -- 
>>> 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/7eaa219b-ddee-4fa2-8ffb-37d04f168965%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/7eaa219b-ddee-4fa2-8ffb-37d04f168965%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/80de9c3d-5ca6-40ba-b521-9cb719a25f9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to