Making a field Read-Only in Django

2014-11-16 Thread Frankline
Hi all, I'm running Django 1.7 and Python 3.4. I'm trying to make the username field of my custom model to be read-only. I think this is usually set in the form. Below is what I currently have in my *forms.py* class AuthUserChangeForm(UserChangeForm): """ A form for updating users. Includ

Re: Runtime warning about a naive datetime when running the test command

2014-11-16 Thread Daniel Grace
Is this a bug in the Django tester? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email

Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2014-11-16 Thread Andreas Ka
thanks for your answer. yes, I just tried that. Same result. By now, I have understood much more about the templates. But still, for the admin pages mysite/templates/admin/base_site.html doesn't work yet. I have actually found more errors in the tutorial: https://docs.djangoproject.com/en/1.7

Re: DecimalField returns 'This value must be a decimal number' when blank

2014-11-16 Thread Vijay Khemlani
I'm not sure if a syncdb changes the null attribute of a field at the DB level, I think you need to make a migration for that. Either way, it would be useful if you could post the declarations of the form and the model to see if everything is ok. On Sun, Nov 16, 2014 at 2:51 PM, elcaiaimar wrote

my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2014-11-16 Thread RLF_UNIQUE
Obviously you've restarted the server and refreshed the page in such a way to ensure it's not a caching issue ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2014-11-16 Thread Andreas Ka
I am working through https://docs.djangoproject.com/en/1.7/intro/tutorial02 so far all went fine - but now *templates changes just don't work.* I think there must be a flaw in that tutorial, something missing, or something different in django 1.7.1 ? https://docs.djangoproject.com/en/1.7/intro/t

DecimalField returns 'This value must be a decimal number' when blank

2014-11-16 Thread elcaiaimar
Hello everybody, I've a problem with DecimalField at Forms. I've a long form in my template and I want to left some fields in blank. I've declared these fields with *required=False*, but when I submit the form I receive this error: '*This value must be a decimal number*'. I've tried to declare

Re: Runtime warning about a naive datetime when running the test command

2014-11-16 Thread Daniel Grace
I understand the problem. Why doesn't the Django tester provide time zone aware date times? I know if I set "USE_TZ = False" the warnings will disappear. I was looking for another solution. Could I conditionally set "USE_TZ = False" only when testing? -- You received this message because y

Get django default model field value to be a parent attribute value

2014-11-16 Thread Matlau Issu
I want the default modB localField value to be the modA wantedField value corresponding to the foreign key. This would gives : class modA(models.Model): wantedField = models.CharField(max_length=9) [ ... other fields ...] def asDefault(): return wantedField

Re: Im having trouble with models when it involves more than 1 class.

2014-11-16 Thread Avraham Serour
please post the exception or the error page you are getting. in any case this seems right to me, on the staff page you inline the location, you are complaining that you can only choose the FK of that location to customer and not staff, well, the staff FK is obviously the one you are editing/creati

Re: form mixin for modelform ?

2014-11-16 Thread James Schneider
Whoops, I referenced the docs for the Model save() function, not the ModelForm save() function. The signatures should be updated: def save(self, commit=True): rather than: def save(self, *args, **kwargs): The super() call would also need to be modified accordingly: def save(self, commit=True):

Re: form mixin for modelform ?

2014-11-16 Thread James Schneider
I understand that the the 'extra fields' are not part of the main model. However, without either providing a save() method definition somewhere, those fields will never be saved. Take the example I posted previously: class ModelFormMixin(forms.ModelForm): extra_field_1 = forms.CharField(requir