These are chat archives for django/django

18th
Aug 2016
Andrew Backer
@awbacker
Aug 18 2016 08:00
I need to manually manage the django response in one of my views, by sending back the response and closing the connection, but continuing processing afterwards ( request -> process -> get redirect url -> return to client & close conn -> finish additional processing for request
My google foo is lacking, and I hope someone can point me to a good overview of that. I'm pretty sure manually closing the connection would upset django ;)
Stephen James
@StephenOrJames
Aug 18 2016 11:47
@awbacker How about you send the response as normal, but just before you send the response you enqueue an asynchronous task that gets handled by something else such as Celery? Would that suffice?
Andrew Backer
@awbacker
Aug 18 2016 12:12
@StephenOrJames Yeah, celery is doing a lot for us, but not a good fit in this case, sadly. That would be a re-architecting of a lot to make it applicable here. Essentially I need to quickly calculate a return value for the user (redirect), but then save the data and do a bit of processing/calculation on it before putting it in the queue.
it would shave .12 seconds off the response time, maybe a bit in the future. long term is to move to async for all of this, with queues of some sort, since the pipeline is getting too complicated. This is just a stopgap
mark
@thenewidealism_twitter
Aug 18 2016 12:24
im using django rest framework and angular js to display the comment box here, does anybody know why this comment form doesn;t function at all? http://192.241.153.25:8000/#/post/image3
Richard Price
@richardjprice
Aug 18 2016 19:24
you're missing {% csrf_token %} in the template?
or disable csrf
joyceambrosio
@joyceambrosio
Aug 18 2016 21:26
Hello, I'm having an issue with the element datepicker from materializecssform. After pick the date, if I try to submit the form it says the field should not be blank. If I disable the tags and input it manually or using another front end tag like 'material' it works. I can't figure out what is happening. Tried some google research but none helped.
Here is my template and the js who activates the datepicker. Note that I had to translate some things but even if I dont use that translation, this wont work.

'''

$('.datepicker').pickadate({
selectMonths: true,
selectYears: 15,
firstDay: 0,
monthsFull: [ 'janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro' ],
monthsShort: [ 'jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez' ],
weekdaysFull: [ 'domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado' ],
weekdaysShort: [ 'dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sab' ],
weekdaysMin: ['d', 's', 't', 'q', 'q', 's', 's'],
today: 'hoje',
clear: 'limpar',
close: 'fechar',
format: 'dd/mm/yyyy',
formatSubmit: dd/mm/yyyy',
});
'''