Re: Adding code when pressing one of admin's save buttons

2017-07-25 Thread Mike Dewhirst
On 25/07/2017 9:29 PM, ron_w_add via Django users wrote: I am using Django’s admin interface to create new records. A record includes (amongst other fields) the date and time that a photo was taken. These fields will be filled into the database when either the ‘Save and add another’, ‘Save an

Re: How can I auto-fill a field in the model without showing a form field to the user?

2017-07-25 Thread Mike Dewhirst
On 26/07/2017 3:15 AM, Alexander Joseph wrote: How did you learn all the methods that are available Django is very comprehensively documented and almost any question you can think up is only a google search away. Typically a search will reveal a Django doc reference and StackOverflow answers.

Re: TypeError: __init__() takes 2 positional arguments but 3 were given (django-material)

2017-07-25 Thread Tim Graham
Please give the exception traceback. On Tuesday, July 25, 2017 at 3:35:41 PM UTC-4, Elias Coutinho wrote: > > Hello guys! > > I'm trying to recreate a form with Inline using django and django-stuff. I > already got it once, but this is not being easy! > > I want to create a form that can register

TypeError: __init__() takes 2 positional arguments but 3 were given (django-material)

2017-07-25 Thread Elias Coutinho
Hello guys! I'm trying to recreate a form with Inline using django and django-stuff. I already got it once, but this is not being easy! I want to create a form that can register a Client and its addresses, or something similar to this link here. Example 1: Adding contacts. Example 2: Adding a

Re: Django Forms HorizontalRadioSelect Renderer not working.

2017-07-25 Thread Tim Graham
Replace renderer=HorizontalRadioRenderer with attrs={'class': 'inline'} and then style radio elements using CSS. contrib.admin uses this approach. Here's the CSS: https://github.com/django/django/blob/d17eaa868cd6911197dcd8b096c4f0418c47007e/django/contrib/admin/static/admin/css/forms.css#L42-L6

Re: upgrading django 1.11 warning list

2017-07-25 Thread Tim Graham
Yes, it's safe to add that to migrations. https://docs.djangoproject.com/en/dev/releases/1.9/#foreignkey-and-onetoonefield-on-delete-argument On Tuesday, July 25, 2017 at 8:55:24 AM UTC-4, pablochud wrote: > > Hi! > It showed me warning related to 'on_delete' as required arg for ForeignKey > in

Re: It's possible to cache entire model

2017-07-25 Thread Fellipe Henrique
Thanks Gideon, I installed here and for now, it's ok! T.·.F.·.A.·. S+F *Fellipe Henrique P. Soares* e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge' *Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh * *B

Re: How can I auto-fill a field in the model without showing a form field to the user?

2017-07-25 Thread Alexander Joseph
Thanks very much, that works great! I'm still lost on what all the methods are that I am able to override. How did you learn all the methods that are available, like the save method, to override? I used some functions in the past with php but mostly I did procedural programming and used a low l

Re: Multiple User Types in Django 1.11

2017-07-25 Thread Gabriel - Iulian Dumbrava
You may go with Russ' solution or you may create two UserGroups, one for Students and one for Teachers, each having different access rights. This also allows for the edge case where a person may be a teacher and a student on the same time. Different behavior at python level can be implemented b

Re: Adding code when pressing one of admin's save buttons

2017-07-25 Thread Thiago Luiz Parolin
Try using 'def save(self):' on your models. When you save a new record, this will be executed, so if you hit any button, you are saving in anyway and the code will be executed. Just my cents about your question. 2017-07-25 8:29 GMT-03:00 ron_w_add via Django users < django-users@googlegroups.com

upgrading django 1.11 warning list

2017-07-25 Thread pablochud
Hi! It showed me warning related to 'on_delete' as required arg for ForeignKey in migration files. is it safty to change migration file manually or is there alternative way to bypass warning? -- You received this message because you are subscribed to the Google Groups "Django users" group. To

upgrading to Django 1.11 warning

2017-07-25 Thread pablochud
Hi, It showed me warning related to 'on_delete' as required arg for ForeignKey in migration files. Is it save to change migration file manually or is there alternative way to bypass this warning? -- You received this message because you are subscribed to the Google Groups "Django users" group

django + GDAL - bus error

2017-07-25 Thread Grégory Bataille
Hi everyone, I have the strangest issue and I don't know how to address it. I'm running on a *mac*. I have *gdal 2.2.0* installed on the system. I have a python 3.5.2 *virtualenv* (same behavior in 3.6.1) inside I have a number of libraries, including *django 1.9.13* and the *GDAL bindings*. If

Adding code when pressing one of admin's save buttons

2017-07-25 Thread ron_w_add via Django users
I am using Django’s admin interface to create new records. A record includes (amongst other fields) the date and time that a photo was taken. These fields will be filled into the database when either the ‘Save and add another’, ‘Save and continue editing’ or the ‘Save’ buttons are pressed (i

Re: It's possible to cache entire model

2017-07-25 Thread Gideon Boateng
> > Hi Fellipe, > if you want to cache an entire model. You can look at this package(Django Cachalot - http://django-cachalot.readthedocs.io/en/latest/ ). I use it in production and its been amazing. It caches the entire ORM and does automatic invalidation. its very easy to use. you literally

Re: Django Forms HorizontalRadioSelect Renderer not working.

2017-07-25 Thread Shazia Nusrat
I am using Djnago 1.11.1. I've tried template approach but perhaps I've missed out something. If you can provide me some workable example I will be really really thankful. Regards, Shazia On Tue, Jul 25, 2017 at 1:57 AM, ecas wrote: > Which version of Django are you using? From 1.11 the widget

Re: From old-school Post/Redirect/Get to modern web

2017-07-25 Thread guettli
Am Montag, 24. Juli 2017 12:58:20 UTC+2 schrieb Christian Ledermann: > > https://blog.levit.be/new-django-admin-with-emberjs-what-are-the-news/ > could give you some insights > > Thank you. This brought me to this: https://github.com/drf-forms/drf-schema-adapter Ember and Angular seem to be s

Re: How can I auto-fill a field in the model without showing a form field to the user?

2017-07-25 Thread ecas
One way could be to overload the save method of the model. Maybe something like this in your models.py: import datetime class Invoice(models.Model): def save(self, *args, **kwargs): if not self.id: today = datetime.date.today() date_str = datetime.dat

Re: ModelForm validation of foreign keys - extra database queries and performance bottleneck

2017-07-25 Thread johan de taeye
I've already tried the select_related in my queryset. No change at all. >>Also keep in mind that Django (or any other framework) has no idea whether or not fields have "changed" in a form submission without pulling the original set of values to compare against, so expect the object to be pul

Re: Django Forms HorizontalRadioSelect Renderer not working.

2017-07-25 Thread ecas
Which version of Django are you using? From 1.11 the widgets changed to a template mechanism. https://docs.djangoproject.com/en/1.11/ref/forms/widgets/#radioselect Maybe this can help: https://stackoverflow.com/questions/44187640/django-1-11-horizontal-choice-field El dimarts, 25 juliol de 2017

Re: ModelForm validation of foreign keys - extra database queries and performance bottleneck

2017-07-25 Thread James Schneider
On Jul 24, 2017 4:09 AM, "johan de taeye" wrote: I have a model that has a foreign key relation to a number of other objects. When saving an instance of this model from the admin (or a ModelForm), I see plenty of extra and redundant database calls. For a single record it wouldn't make much of a

Re: The best way to use AMP of google with Django

2017-07-25 Thread James Schneider
On Jul 24, 2017 10:54 AM, "carlos" wrote: Hi, i have blogs with Django i need use AMP (https://www.ampproject.org/) After a quick look at the link, it doesn't appear as though that service will support Django. It in itself is a development framework geared towards fast mobile applications, with

Django Forms HorizontalRadioSelect Renderer not working.

2017-07-25 Thread Shazia Nusrat
Hi, I need to select form values horizontally but couldn't get it work. Following is the code: class HorizontalRadioRenderer(forms.RadioSelect.renderer): def render(self): return mark_safe(u'\n'.join([u'%s\n' % w for w in self])) class ResponseForm(models.ModelForm): class Meta: