These are chat archives for django/django

Feb 2018
Marios Panagopoulos
Feb 12 2018 00:00
list_with_ids  = [6,3,1]
preserved = Case(*[When(pk=pk, then=pos) for pos, pk in enumerate(list_with_ids)])
queryset = Example.objects.filter(id__in = list_with_ids).order_by(preserved)
I solved it like this
Feb 12 2018 00:04
@MariosPanag :thumbsup:
Feb 12 2018 00:46
In django, we are using redirect using relative path. But we want to convert all http to https when doing redirect, if not do redirect, then just use http. How to do this?
lakshya aggarwal
Feb 12 2018 04:36
Hey. I am working on dynamic formsets. I am using jquery to dynamically add a new form to formset and display but the data from these forms is not being sent to my Attaching my index.html javascript snippet.
Can anyone suggest changes or an alternative method?
Feb 12 2018 06:24
@ptink I was trying installing this project
Feb 12 2018 09:23
@bochiedev Your both user are StaffAdmin
Feb 12 2018 11:05
@siddhantdubey you can start practicing django in this repo her
Siddhant Dubey
Feb 12 2018 11:33
@philipmutua Thanks I will check that out
Ahmed Kotb
Feb 12 2018 13:44
Hi, I have a Form 'not ModelForm' which has an image upload.. all i want is to save it in the /media/ and just save the url somewhere in the db..
how to do so since I have everything up until form.cleaned_data['image_file']
in other words, form cleaned data gives me an InMemoryUploadedFile object.. how to save it in /media/ and generate a url for it?
Feb 12 2018 18:46
you don't save your file directly in the form. you simply set it to a field on your model and save the model instance
e.g. myphoto.image = self.cleaned_data.get('image')