Re: Why leave explicit null=True when blank is True in IntegerField, DateField etc?

2015-09-21 Thread Shai Berger
Hi,

(edited a little)

On Tuesday 22 September 2015 03:07:37 Tim Graham wrote:
> On Monday, September 21, 2015 at 6:52:08 PM UTC-4, Paulo Maciel wrote:
> > Why confused? It's optional, if the developer wanna put null=True, he
> > could.
> > I don't think need to be putting null = True, this is redundant. If this
> > is a standard behavior, you need not be explicit.
>
> As Yo-Yo mentioned, there are valid use cases for blank=True, null=False,
> and I believe having one field option implicitly change another actually
> adds complexity instead of simplifying things.
> 
Even if we did accept some sort of implication there, it would be the other 
way around. "null=True" is a feature of the model field itself, while 
"blank=True" only sets the default behavior of form fields generated for it. It 
would make some sense for null=True to imply blank=True, but not as you 
suggest.

Shai.


Re: Why leave explicit null=True when blank is True in IntegerField, DateField etc?

2015-09-21 Thread Tim Graham
As Yo-Yo mentioned, there are valid use cases for blank=True, null=False, 
and I believe having one field option implicitly change another actually 
adds complexity instead of simplifying things.

On Monday, September 21, 2015 at 6:52:08 PM UTC-4, Paulo Maciel wrote:
>
> Why confused? It's optional, if the developer wanna put null=True, he 
> could.
> I don't think need to be putting null = True, this is redundant. If this 
> is a standard behavior, you need not be explicit.
> I think this should be optional, by default these fields should always be 
> null=True implicitly.
> Django's philosophy is to simplify.
>
> Em quinta-feira, 17 de setembro de 2015 10:23:49 UTC-3, Tom Christie 
> escreveu:
>>
>> That kind of implicit behavior would just leave things more confused.
>> Writing a few characters less code isn't a benefit if it comes at the 
>> expense of making the behavior less obvious.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e6d1503d-1707-4715-8e15-c8cc268d372c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why leave explicit null=True when blank is True in IntegerField, DateField etc?

2015-09-21 Thread Paulo Maciel
Why confused? It's optional, if the developer wanna put null=True, he could.
I don't think need to be putting null = True, this is redundant. If this is 
a standard behavior, you need not be explicit.
I think this should be optional, by default these fields should always be 
null=True implicitly.
Django's philosophy is to simplify.

Em quinta-feira, 17 de setembro de 2015 10:23:49 UTC-3, Tom Christie 
escreveu:
>
> That kind of implicit behavior would just leave things more confused.
> Writing a few characters less code isn't a benefit if it comes at the 
> expense of making the behavior less obvious.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/9c5b75d3-d993-4871-800e-d25b6b72731c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why leave explicit null=True when blank is True in IntegerField, DateField etc?

2015-09-17 Thread Tom Christie
That kind of implicit behavior would just leave things more confused.
Writing a few characters less code isn't a benefit if it comes at the 
expense of making the behavior less obvious.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/0e56558e-0efd-467f-8b08-75e20c5e6fae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why leave explicit null=True when blank is True in IntegerField, DateField etc?

2015-09-16 Thread Yo-Yo Ma
Another reason you want the two to be separate is that you might allow a field 
to be blank in forms but then set the value to some context-specific value (vs 
a simple default=x) before saving.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/cb880dcd-cd9e-4fca-9950-08948dd136c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why leave explicit null=True when blank is True in IntegerField, DateField etc?

2015-09-16 Thread Enrique Paredes
Well, one can call the Zen of python, about just exactly that. explicit is 
better than implicit.


In this case, explicit becomes a problem for getting used to it, versus 
implicit that becomes a strange behavior/bug/wtf when you don't expect it.




I'll rather see a ValueError if this is something the model field can't afford 
(Doesn't do it already?)




Cheers,

E.





—
Sent from Mailbox

On Thu, Sep 17, 2015 at 12:36 AM, Paulo Maciel 
wrote:

> It would be better if IntegerField, DateField, etc did not have to leave 
> explicit null=True when blank is True. 
> In my opinion it might look like:
> class Abc(models.Model):
> number = models.IntegerField(blank=True)  # doesn't need leave explicit 
> null=True, it's should be default if blank is True
> What do you think?
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers  (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/7ced3a69-fd04-4ac9-9334-8fde61726810%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1442460232075.4cd4456e%40Nodemailer.
For more options, visit https://groups.google.com/d/optout.


Why leave explicit null=True when blank is True in IntegerField, DateField etc?

2015-09-16 Thread Paulo Maciel
It would be better if IntegerField, DateField, etc did not have to leave 
explicit null=True when blank is True. 

In my opinion it might look like:

class Abc(models.Model):
number = models.IntegerField(blank=True)  # doesn't need leave explicit 
null=True, it's should be default if blank is True


What do you think?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/7ced3a69-fd04-4ac9-9334-8fde61726810%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.