Re: Allow usage of widgets in generic class-based views?

2018-12-05 Thread Carlton Gibson
I'd be pretty sceptical about any extra API here. Even an extra hook seems a bit much. def get_form_class(self): base_form = super().get_form_class() return modelform_factory(self.model, base_form, widgets=...) Job done, no? (This assuming that "Just declare your form class normally"

Re: Default upload permissions

2018-12-05 Thread Carlton Gibson
Hi all, This has come up again. So proposal below. https://code.djangoproject.com/ticket/30004 "Document TemporaryUploadedFile potential permission issues" Issue is that, with the default settings, you get 0o644 permissions for "small" files and 0o600 permissions for "big" ones. (Depending o

A faster paginator for django

2018-12-05 Thread Saleem Jaffer
Hi all, The default paginator that comes with Django is inefficient when dealing with large tables. This is because the final query for fetching pages uses "OFFSET" which is basically a linear scan till the last index of the current page. Does it make sense to have a better paginator which does

PROBLEM

2018-12-05 Thread David Figueroa
In creating my first django project- I'm trying to create my first application (polls) through a view as shown below. I'm finding the error shown in the image in the Annex. can anybody help me? I'm following the step-by-step suggested in ( https://docs.djangoproject.com/pt-br/1.11/intro/tutorial01

Re: PROBLEM

2018-12-05 Thread Carlton Gibson
Hi David, This group is for "Contributions to Django itself". You need to head over to Django Users for support questions. (But it looks like you didn't save your urls.py — the `polls/` route isn't shown as being searched.) Good luck!

Re: A faster paginator for django

2018-12-05 Thread ludovic coues
The preferred way for this kind of scenario is to make a third party package. This let you release new version faster than the Django development cycle and it's super easy to install thanks to tools like pip. Once your solution is stable, if it's popular enough, it could be incorporated into Djang

Re: A faster paginator for django

2018-12-05 Thread Jason Johns
https://www.citusdata.com/blog/2016/03/30/five-ways-to-paginate/ has some interesting alternatives. I believe Django uses the first one. But the others have some tradeoffs that might not apply to all the dbs that django supports. -- You received this message because you are subscribed to the

Re: Allow usage of widgets in generic class-based views?

2018-12-05 Thread Dan Frankowski
Ah, I see. It looks like I can use modelform_factory. So: class PatientCreate(LoginRequiredMixin, UserOrgRequiredMixin, CreateView): model = models.Patient fields = ['name', 'caregiver_name', 'sex', 'birth_date', 'residence', 'country'] becomes from django.forms.models imp

Re: Allow usage of widgets in generic class-based views?

2018-12-05 Thread Alasdair Nicol
This is getting into django-users territory, but I wanted to point out that it's often better to leave out the field instead of using a hidden input. You can then override the form_valid() method, and set the value before the form is saved. class PatientCreate(LoginRequiredMixin, UserOrgReq

Re: A faster paginator for django

2018-12-05 Thread Adam Johnson
There are already some packages on listed on djangopackages that claim to implement different pagination strategies: https://djangopackages.org/grids/g/pagination/ On Wed, 5 Dec 2018 at 12:37, Jason Johns wrote: > https://www.citusdata.com/blog/2016/03/30/five-ways-to-paginate/ has some > intere

Re: A faster paginator for django

2018-12-05 Thread Curtis Maloney
On 12/5/18 8:30 PM, Saleem Jaffer wrote: Hi all, The default paginator that comes with Django is inefficient when dealing with large tables. This is because the final query for fetching pages uses "OFFSET" which is basically a linear scan till the last index of the current page. Does it make