Form validation - char field coerces *any* data into a unicode

2013-02-09 Thread Yo-Yo Ma
A form that has a char field (e.g. "name") when provided a dict of data 
will convert the value of "name" to a Unicode, no matter what. I understand 
that this is desirable in some circumstances, but it can lead to things 
like:

>>> product.name
u"{'haha': 'I am a dict'}"

Perhaps this is desirable, but I wonder if there is any merit to the idea 
of sanitizing data to ensure it is "valid" for a char field, since 
practically *any* Python object can be cast into a Unicode (vs a 
DecimalField or an IntegerField, which will raise an error).

I realize the distinction of a "valid" would be completely arbitrary (e.g., 
who's to say that a dict isn't a valid char field value, but an that 
integer is?), but nonetheless, here I am, requesting feedback.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Form validation - char field coerces *any* data into a unicode

2013-02-09 Thread Yo-Yo Ma
I should note, the use case for this is when the data is being provided to 
the form through a mechanism other than normal HTTP form-encoded via 
request.POST, such as an API that consumes JSON.

>>> product.name
> u"{'haha': 'I am a dict'}"
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Form validation - char field coerces *any* data into a unicode

2013-02-09 Thread Shai Berger
On Saturday 09 February 2013, Yo-Yo Ma wrote:
> A form that has a char field (e.g. "name") when provided a dict of data
> will convert the value of "name" to a Unicode, no matter what. I understand
> that this is desirable in some circumstances, but it can lead to things
> 
> like:
> >>> product.name
> 
> u"{'haha': 'I am a dict'}"
> 
> Perhaps this is desirable, but I wonder if there is any merit to the idea
> of sanitizing data to ensure it is "valid" for a char field, since
> practically *any* Python object can be cast into a Unicode (vs a
> DecimalField or an IntegerField, which will raise an error).
> 
> I realize the distinction of a "valid" would be completely arbitrary (e.g.,
> who's to say that a dict isn't a valid char field value, but an that
> integer is?), but nonetheless, here I am, requesting feedback.

I think an important point to keep in mind is that it isn't just 'dict', but 
also ArbitraryUserClass which is considered valid today, and losing this will 
break many users' code. So I'm -1 on adding such validation to the core 
CharField.

There may be merit to such validation in special cases -- for this, it is easy 
enough to subclass CharField and override its to_python() method (that's the 
one that converts the value to unicode). Something along the lines of

class StrictCharField(CharField):
def to_python(self, value):
if isinstance(value, basestring):
return super(StrictCharField, self).to_python(value)
else:
raise TypeError('Get off my lawn')

(this is untested python-2-only pseudocode, YMMV).

My 2 cents,
Shai.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Next steps for ticket #18150

2013-02-09 Thread Steven Vargas
Added an updated patch last night. Could someone look it over?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Guidance regarding Django Deployment Process

2013-02-09 Thread Kaung Htet Zaw
Hi all,

I am a teenager who have been picking up Django development in my own time. 
I have reached a state where I am relatively comfortable with the django 
framework, setting up a *local* development environment, dealing with 
database setup and installation of third-party packages etc. I have several 
personal pet projects running on PaaS platforms (free plans) such as Heroku 
since they take care of a lot deployment process behind the scene given the 
fact that I am not familiar with the deployment process as well.  
 Therefore, I would like to be more comfortable with the deployment process 
as well as the technology stack available out there, what are the common 
practices and conventions, methods and tools used. There are a lot of 
terminologies floating around regarding the deployment according to a lot 
my research and attempts to deploy such as nginx, apache, wsgi, fabric, 
cherokee and I am not really sure how they tie up together, fall into which 
categories and I am hoping some of you experienced developers here can help 
me shed a light.

Essentially given a bare bone VPS of ubuntu ( since this is the distro that 
I am most familiar with ) with a root access, I would like to be able to 
comfortably deploy my django application and know what I am supposed to be 
doing in each step. I am perfectly comfortable with self-learning if given 
a hopefully detailed guidance to bring my dev-fu to next level. 

Thank you very much for your time.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




TIMEZONE default

2013-02-09 Thread Jonathan Loy
Hey everybody,

Quick question. In version 1.6 why is TIME_ZONE in 
django.conf.global_settings
 set 
to 'America/Chicago', but in the default project template TIME_ZONE = 
'UTC'? Shouldn't they be the same, and if so which one? Thanks for taking 
the time to read/answer my queston.


v/r
Jonathan

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Guidance regarding Django Deployment Process

2013-02-09 Thread Luke Granger-Brown
Hey!

I'm in a similar boat to you, but this mailing list is for the development
of Django only, and not for general Django related questions.

You might want to try asking on the django-users list.

Luke


On Fri, Feb 8, 2013 at 12:07 PM, Kaung Htet Zaw  wrote:

> Hi all,
>
> I am a teenager who have been picking up Django development in my own
> time. I have reached a state where I am relatively comfortable with the
> django framework, setting up a *local* development environment, dealing
> with database setup and installation of third-party packages etc. I have
> several personal pet projects running on PaaS platforms (free plans) such
> as Heroku since they take care of a lot deployment process behind the scene
> given the fact that I am not familiar with the deployment process as well.
>  Therefore, I would like to be more comfortable with the deployment process
> as well as the technology stack available out there, what are the common
> practices and conventions, methods and tools used. There are a lot of
> terminologies floating around regarding the deployment according to a lot
> my research and attempts to deploy such as nginx, apache, wsgi, fabric,
> cherokee and I am not really sure how they tie up together, fall into which
> categories and I am hoping some of you experienced developers here can help
> me shed a light.
>
> Essentially given a bare bone VPS of ubuntu ( since this is the distro
> that I am most familiar with ) with a root access, I would like to be able
> to comfortably deploy my django application and know what I am supposed to
> be doing in each step. I am perfectly comfortable with self-learning if
> given a hopefully detailed guidance to bring my dev-fu to next level.
>
> Thank you very much for your time.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" 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?hl=en
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Guidance regarding Django Deployment Process

2013-02-09 Thread Karen Tracey
Please ask questions about using Django on django-users. The topic of this
list is the development of Django itself.

Thanks,
Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: TIMEZONE default

2013-02-09 Thread Alex Ogier
Hi Jonathan,

I don't know the particular history of this setting, but this sounds like
something that was done to maintain backwards compatibility. My guess is
that when Django was first released, it defaulted to 'America/Chicago' but
later on it was recognized that using UTC time on the server is a better
way of handling times. As a result, if the settings module doesn't contain
a TIME_ZONE setting, then you get 'America/Chicago' in order to be
backwards compatible, but when you make a new project you get the current
best-practice setting which is UTC.

Best,
Alex Ogier


On Sat, Feb 9, 2013 at 12:21 PM, Jonathan Loy  wrote:

> Hey everybody,
>
> Quick question. In version 1.6 why is TIME_ZONE in
> django.conf.global_settings
>  set
> to 'America/Chicago', but in the default project template TIME_ZONE =
> 'UTC'? Shouldn't they be the same, and if so which one? Thanks for taking
> the time to read/answer my queston.
>
>
> v/r
> Jonathan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" 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?hl=en
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: TIMEZONE default

2013-02-09 Thread Aymeric Augustin
Alex' answer is correct — and "later on" is actually a few days ago :)

UTC isn't a best practice as much as a country-agnostic practice. You're 
supposed to put your own time zone there.

There are a few other discrepancies between global_settings.py and the default 
project template, notably USE_L10N and USE_TZ.

If you search the archives of this mailing list you'll find a detailed 
explanation for USE_TZ.

-- 
Aymeric.


Le 9 févr. 2013 à 23:44, Alex Ogier  a écrit :

> Hi Jonathan,
> 
> I don't know the particular history of this setting, but this sounds like 
> something that was done to maintain backwards compatibility. My guess is that 
> when Django was first released, it defaulted to 'America/Chicago' but later 
> on it was recognized that using UTC time on the server is a better way of 
> handling times. As a result, if the settings module doesn't contain a 
> TIME_ZONE setting, then you get 'America/Chicago' in order to be backwards 
> compatible, but when you make a new project you get the current best-practice 
> setting which is UTC.
> 
> Best,
> Alex Ogier
> 
> 
> On Sat, Feb 9, 2013 at 12:21 PM, Jonathan Loy  wrote:
> Hey everybody,
> 
> Quick question. In version 1.6 why is TIME_ZONE in 
> django.conf.global_settings set to 'America/Chicago', but in the default 
> project template TIME_ZONE = 'UTC'? Shouldn't they be the same, and if so 
> which one? Thanks for taking the time to read/answer my queston.
> 
> 
> v/r
> Jonathan
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers" 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers" 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
Aymeric.



-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: TIMEZONE default

2013-02-09 Thread Jonathan Loy
Thank you Alex and Aymeric for your responses. Since that is the situation, 
maybe an explanation should be included in the settings documentation? 

On Saturday, February 9, 2013 5:51:51 PM UTC-5, Aymeric Augustin wrote:
>
> Alex' answer is correct — and "later on" is actually a few days ago :)
>
> UTC isn't a best practice as much as a country-agnostic practice. You're 
> supposed to put your own time zone there.
>
> There are a few other discrepancies between global_settings.py and the 
> default project template, notably USE_L10N and USE_TZ.
>
> If you search the archives of this mailing list you'll find a detailed 
> explanation for USE_TZ.
>
> -- 
> Aymeric.
>
>
> Le 9 févr. 2013 à 23:44, Alex Ogier > a 
> écrit :
>
> Hi Jonathan,
>
> I don't know the particular history of this setting, but this sounds like 
> something that was done to maintain backwards compatibility. My guess is 
> that when Django was first released, it defaulted to 'America/Chicago' but 
> later on it was recognized that using UTC time on the server is a better 
> way of handling times. As a result, if the settings module doesn't contain 
> a TIME_ZONE setting, then you get 'America/Chicago' in order to be 
> backwards compatible, but when you make a new project you get the current 
> best-practice setting which is UTC.
>
> Best,
> Alex Ogier
>
>
> On Sat, Feb 9, 2013 at 12:21 PM, Jonathan Loy 
> > wrote:
>
>> Hey everybody,
>>
>> Quick question. In version 1.6 why is TIME_ZONE in 
>> django.conf.global_settings
>>  set 
>> to 'America/Chicago', but in the default project template TIME_ZONE = 
>> 'UTC'? Shouldn't they be the same, and if so which one? Thanks for taking 
>> the time to read/answer my queston.
>>
>>
>> v/r
>> Jonathan
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-develop...@googlegroups.com .
>> To post to this group, send email to 
>> django-d...@googlegroups.com
>> .
>> Visit this group at 
>> http://groups.google.com/group/django-developers?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-develop...@googlegroups.com .
> To post to this group, send email to django-d...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/django-developers?hl=en
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>
>
> -- 
> Aymeric.
>
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Allowing Reverse, Single Inlines in Admin

2013-02-09 Thread Jannis Gee
Any new infos on this one? I'd love to see it in django.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Guidance regarding Django Deployment Process

2013-02-09 Thread Aswani Kumar
same here, but i can help you with exp i have, (recently i deployed with 
nginx+uWSGI) let every one know if you get help from a better linux admin.

you can contact me to get basic info which i aquired.

On Friday, February 8, 2013 5:37:58 PM UTC+5:30, Kaung Htet Zaw wrote:
>
> Hi all,
>
> I am a teenager who have been picking up Django development in my own 
> time. I have reached a state where I am relatively comfortable with the 
> django framework, setting up a *local* development environment, dealing 
> with database setup and installation of third-party packages etc. I have 
> several personal pet projects running on PaaS platforms (free plans) such 
> as Heroku since they take care of a lot deployment process behind the scene 
> given the fact that I am not familiar with the deployment process as well.  
>  Therefore, I would like to be more comfortable with the deployment process 
> as well as the technology stack available out there, what are the common 
> practices and conventions, methods and tools used. There are a lot of 
> terminologies floating around regarding the deployment according to a lot 
> my research and attempts to deploy such as nginx, apache, wsgi, fabric, 
> cherokee and I am not really sure how they tie up together, fall into which 
> categories and I am hoping some of you experienced developers here can help 
> me shed a light.
>
> Essentially given a bare bone VPS of ubuntu ( since this is the distro 
> that I am most familiar with ) with a root access, I would like to be able 
> to comfortably deploy my django application and know what I am supposed to 
> be doing in each step. I am perfectly comfortable with self-learning if 
> given a hopefully detailed guidance to bring my dev-fu to next level. 
>
> Thank you very much for your time.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.