Re: prepopulate form with model instance values using UpdateView and ModelForm

2017-01-18 Thread Sergiy Khohlov
Hello, I had a similar problem (but I'm using DetailView for sending some additional data) and I hope I can help Usually editing page is using GET for receiving default data and POST for sending data from form to view ( we are skipping ajax way) 1) You would like to set initial data to th

readonly and autofocus support in form fields?

2017-01-18 Thread Norberto Bensa
Hello, I usually need to make form fields readonly or autofocus (the app I'm developing right now has a lot of these). While I can do it in the form or a custom field, I'm wondering why there's no support for these attributes out-of-the-box (btw, there's support for disabled). TIA, Norberto --

Re: prepopulate form with model instance values using UpdateView and ModelForm

2017-01-18 Thread Melvyn Sopacua
On Wednesday 18 January 2017 14:26:52 Benjamin Dauer wrote: > Hi Melvyn, > > That's exactly what I'm trying to do, but prior to making the changes > it wasn't prepopulating. At each stage I tested and was getting blank > fields albeit based off of the correct model. > > Maybe it's because I don't

Re: Django search

2017-01-18 Thread Luis Zárate
This could be usefull Model.objects. filter(q='hello', b='world') Can be expressed as params ={'q': 'hello', 'b': 'world') Model.objects.filter (**params) El martes, 17 de enero de 2017, Branko Zivanovic < international11...@gmail.com> escribió: > Yes that is true, and I have succeeded in m

Re: Edx LDAP Auth setting

2017-01-18 Thread 'Faruk D.' via Django users
Hi Yip, Thanks for your Instruction. While trying to update the database record like you explained on step 16. I got some error messages. Im not so familar with that django and python stuff. Im going to give a description of my errors. I hope someone can help me. I am using the following Ful

Select related single object on reverse foreign key set

2017-01-18 Thread M. Meent
Hi, I have the following structure: class A(models.Model): date = DateField(nullable=True) ... class B(models.Model): a = ForeignKey(A) a_date_is_null_at_creation = BooleanField() ... I select the following data this way: (an O(n) operation fo

Re: Django channels, running uwsgi and awsgi

2017-01-18 Thread Andrew Godwin
On Wed, Jan 18, 2017 at 12:33 AM, Dev App wrote: > > I hope there 's a documentation how to do "running-asgi-alongside-wsgi" > https://channels.readthedocs.io/en/stable/deploying.html# > running-asgi-alongside-wsgi > (I tried google, but none found for how to do it) > > I'm just afraid to hand ov

Re: StreamingHttpResponse response length in a stats middleware

2017-01-18 Thread 'Tom Evans' via Django users
On Wed, Jan 18, 2017 at 11:42 AM, Stefano Tranquillini wrote: > Hi there, > > I'm using the StreamingHttpResponse to stream a response, it works great. > Now, I've a middleware that measures the size of req/response that users do. > For normal HttpResponse i use len(response.content) [i know that

Re: What is the fate of closed database connections?

2017-01-18 Thread 'Tom Evans' via Django users
On Tue, Jan 17, 2017 at 7:58 PM, Fred Stluka wrote: > Mike, > > As of version 1.6, Django supports persistent DB connections > (connection pooling). Pedantry: Persistent connections are not the same as connection pooling. With persistent connections, if a worker does not have a currently open con

Re: prepopulate form with model instance values using UpdateView and ModelForm

2017-01-18 Thread Benjamin Dauer
Hi Melvyn, That's exactly what I'm trying to do, but prior to making the changes it wasn't prepopulating. At each stage I tested and was getting blank fields albeit based off of the correct model. Maybe it's because I don't provide the pk in the URL? I was trying to avoid that. On Wed, Jan 18, 2

Re: prepopulate form with model instance values using UpdateView and ModelForm

2017-01-18 Thread Melvyn Sopacua
On Wednesday 18 January 2017 04:44:01 dauer.benjamin wrote: > Question for you all. Appreciate any insight you can give. So I have a > class-based view (UpdateView) and a ModelForm. I want the form to > pre-populate with data from a model instance. It feels like you're doing work that's already d

prepopulate form with model instance values using UpdateView and ModelForm

2017-01-18 Thread dauer.benjamin
Hey folks, Question for you all. Appreciate any insight you can give. So I have a class-based view (UpdateView) and a ModelForm. I want the form to pre-populate with data from a model instance. I've googled around a lot, couldn't find a plug n' play solution. I have a partial solution but it f

Clone formset

2017-01-18 Thread Adam Teale
Hi everyone, Is it possible to clone a formset (inlineformset_factory)? I'm not sure what would be the correct way to do so. I am able to clone the form by: form = self.get_form(form_class) form.instance.pk = None form.instance.save() When it comes to the formset I don't know the method. I thi

Re: What is the best library for Facebook social auth?

2017-01-18 Thread Vijay Khemlani
I like django-allauth http://django-allauth.readthedocs.io/en/latest/ On 1/18/17, christina zou wrote: > Hi, > > I am new to Django and web development in general. I am trying to > incorporate facebook social auth into django. I assume this is a common > need for which there is a well supported

Re: What is the best library for Facebook social auth?

2017-01-18 Thread Christian Ledermann
On 18 January 2017 at 07:13, christina zou wrote: > Hi, > > I am new to Django and web development in general. I am trying to > incorporate facebook social auth into django. I assume this is a common need > for which there is a well supported library. > > I was using django-social-auth and running

Re: How to make a queryset into a database, starting from a template html

2017-01-18 Thread Melvyn Sopacua
On Tuesday 17 January 2017 08:42:40 carlobo wrote: > in a html template I receive some input to create a new record in a > database . One of these inputs is the international dialing prefix > (such as +39 for Italy). In another field of the same template there > is another input to enter the countr

Django channels, running uwsgi and awsgi

2017-01-18 Thread Dev App
I hope there 's a documentation how to do "running-asgi-alongside-wsgi" https://channels.readthedocs.io/en/stable/deploying.html#running-asgi-alongside-wsgi (I tried google, but none found for how to do it) I'm just afraid to hand over every request to asgi which I don't know much about. I hav

What is the best library for Facebook social auth?

2017-01-18 Thread christina zou
Hi, I am new to Django and web development in general. I am trying to incorporate facebook social auth into django. I assume this is a common need for which there is a well supported library. I was using django-social-auth and running into a lot of errors. In particular, I am currently receivi

StreamingHttpResponse response length in a stats middleware

2017-01-18 Thread Stefano Tranquillini
Hi there, I'm using the StreamingHttpResponse to stream a response, it works great. Now, I've a middleware that measures the size of req/response that users do. For normal HttpResponse i use len(response.content) [i know that it does not give the bytes, but it's pretty close], for the streamin