Re: postgresql range types v2

2013-01-16 Thread Simon Litchfield
Also, did you see psycopg2.extras.DateTimeRange?

On Monday, December 31, 2012 8:56:12 PM UTC+11, mpaolini wrote:
>
> Hi all, 
>
> sorry for the noise, forget my previous mail as it was pointing to the 
> wrong commit, 
> here's the good one: 
>
>
> https://github.com/mpaolini/django/commit/b754abdeab204949510500ccb1b845b7ad143542
>  
>
> copying here the rest of the original mail: 
>
> postgresql since version 9.2 added support for range types [1] 
> they have a nice set of specialized operators like "overlaps", "left of", 
> etc... [2] 
>
> So I decided to work on a reference implementation for Django 
> even if it looks like psycopg2 does not fully support yet these data types 
> [3] 
>
> The implementation is only a proof of concept and is not complete and not 
> tested 
> (but it does contain tests, of course!) 
>
> I did: 
>   - datetime range python data type: two bounds plus inclusive/excusive 
> info (very basic!) 
>   - datetime range model field 
>   - range specific lookups for querysets 
>   - non-overlapping constraint: db-level enforced with sql CONSTRAINT and 
> model validation 
>   - some documentation 
>
> TODO: 
>   - form, widget, modelform, localization, admin 
>   - more range types (int, bigint, etc...) 
>   - more validation against invalid ranges 
>   - better range type python implementation 
>   - more testing 
>
> Do you like it? Any chances for it to land in master once it is completed? 
> Or is it too specialized? 
>
> Cheers, 
>
> Marco 
>
> [1] http://www.postgresql.org/docs/9.2/static/rangetypes.html 
> [2] 
> http://www.postgresql.org/docs/9.2/static/functions-range.html#RANGE-OPERATORS-TABLE
>  
> [3] http://archives.postgresql.org/psycopg/2012-09/msg00051.php 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/shC1MhFZg4YJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: postgresql range types v2

2013-01-16 Thread Simon Litchfield
Marco, this is great. 

I wonder if it would be possible to add range fields without modifying 
django? 


On Monday, December 31, 2012 8:56:12 PM UTC+11, mpaolini wrote:
>
> Hi all, 
>
> sorry for the noise, forget my previous mail as it was pointing to the 
> wrong commit, 
> here's the good one: 
>
>
> https://github.com/mpaolini/django/commit/b754abdeab204949510500ccb1b845b7ad143542
>  
>
> copying here the rest of the original mail: 
>
> postgresql since version 9.2 added support for range types [1] 
> they have a nice set of specialized operators like "overlaps", "left of", 
> etc... [2] 
>
> So I decided to work on a reference implementation for Django 
> even if it looks like psycopg2 does not fully support yet these data types 
> [3] 
>
> The implementation is only a proof of concept and is not complete and not 
> tested 
> (but it does contain tests, of course!) 
>
> I did: 
>   - datetime range python data type: two bounds plus inclusive/excusive 
> info (very basic!) 
>   - datetime range model field 
>   - range specific lookups for querysets 
>   - non-overlapping constraint: db-level enforced with sql CONSTRAINT and 
> model validation 
>   - some documentation 
>
> TODO: 
>   - form, widget, modelform, localization, admin 
>   - more range types (int, bigint, etc...) 
>   - more validation against invalid ranges 
>   - better range type python implementation 
>   - more testing 
>
> Do you like it? Any chances for it to land in master once it is completed? 
> Or is it too specialized? 
>
> Cheers, 
>
> Marco 
>
> [1] http://www.postgresql.org/docs/9.2/static/rangetypes.html 
> [2] 
> http://www.postgresql.org/docs/9.2/static/functions-range.html#RANGE-OPERATORS-TABLE
>  
> [3] http://archives.postgresql.org/psycopg/2012-09/msg00051.php 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/EXxINLYk-hgJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: make the source code of the django tutorial available ?

2013-01-16 Thread Russell Keith-Magee
On Thu, Jan 17, 2013 at 1:17 PM, Daniel Greenfeld  wrote:

>
>
> On Wednesday, January 16, 2013 4:43:14 PM UTC-8, Russell Keith-Magee wrote:
>
>> Hi Daniele,
>>
>> On Thu, Jan 17, 2013 at 7:07 AM, Daniele Procida 
>> wrote:
>>
>>>
>>>  2) This is what version control is for. I'd much rather see someone do
>> the tutorial and use version control on their own repository, rather than
>> just pull down the latest version of a repo that contains all the code they
>> need.
>>
>> Following point 2, it might be worth suggesting that people use version
>> control during the tutorial. I'm not suggesting we turn the Django tutorial
>> into a parallel tutorial on git, but seeding the idea in people's heads has
>> the benefit of reinforcing best practice (you do version control everything
>> you do, right?), and makes it easier to work around the rollback problems
>> you describe; if they don't know what version control is, they might be
>> encouraged to go investigate, and as a result, another code-fairy gets
>> their wings :-)
>>
>
> There are already third-party versions of the Django tutorial that also
> instruct on source control and TDD. These are great, and wonderful, but I
> feel they overwhelm beginner Django developers with too much.
>

To be clear -- I'm not suggesting we try and make the Django tutorial a
parallel tutorial on source control. I'm just suggesting that we drop a
gentle hint at the start of the tutorial, to the effect of:

"If you know how to use a source control system (like Git), you might want
to set up your tutorial directory as a repository.

If you don't know how to use a source control system, don't worry. You
don't need to know anything about source control to complete this tutorial.
However, source control systems are incredibly useful tools that are used
widely in software development, and you'd be well advised to learn how to
use them."

and then, after completing relevant blocks of work:

"If you're using source control on this project, now would be a good time
to commit what you've done."

The aim is to encourage best practice, or at least make users *aware* of
best practice, but leave the details up to them.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: make the source code of the django tutorial available ?

2013-01-16 Thread Daniel Greenfeld


On Wednesday, January 16, 2013 4:43:14 PM UTC-8, Russell Keith-Magee wrote:
>
> Hi Daniele,
>
> On Thu, Jan 17, 2013 at 7:07 AM, Daniele Procida 
>  > wrote:
>
>> I'm re-opening an old discussion - 
>> https://groups.google.com/d/topic/django-developers/MbLD1BL5xkQ/discussion. 
>> Sorry if it all comes out weird, I'm having to do it in Google Groups.
>>
>> I propose maintaining a repository of the Polls tutorial code, with each 
>> branch representing the state of the code at the end of each tutorial.
>>
>> I realise that there is a danger that people might be tempted simply to 
>> checkout the code rather than type it in, following all the useful steps 
>> and mis-steps that the tutorial provides, but at the same time it would 
>> have other significant advantages that it would be a shame to forego just 
>> in order to save people from temptation, especially if they are strongly 
>> warned against it.
>>
>>
> Yes, because the best way to make sure nobody presses a button is to put a 
> sign over it saying "Under no circumstances press this button" :-)
>

What Russell said. 
 

> I can see what you're trying to achieve here, but I'm still not convinced. 
>
>  1) The tutorials aren't that complex; even if you did have to reproduce 
> them from scratch, it doesn't take that long (I've done this quite a few 
> times, so I'm speaking from experience here). 
>

If you copy/paste from an existing code base to get the tutorial working, 
then the tutorial is meaningless. Part of learning Django, Python, or 
whatever is through the experience of finding and fixing your mistakes. 
Making an official repository for the tutorial would be a disservice for 
would-be developers.
 

>
>  2) This is what version control is for. I'd much rather see someone do 
> the tutorial and use version control on their own repository, rather than 
> just pull down the latest version of a repo that contains all the code they 
> need.
>
> Following point 2, it might be worth suggesting that people use version 
> control during the tutorial. I'm not suggesting we turn the Django tutorial 
> into a parallel tutorial on git, but seeding the idea in people's heads has 
> the benefit of reinforcing best practice (you do version control everything 
> you do, right?), and makes it easier to work around the rollback problems 
> you describe; if they don't know what version control is, they might be 
> encouraged to go investigate, and as a result, another code-fairy gets 
> their wings :-)
>

There are already third-party versions of the Django tutorial that also 
instruct on source control and TDD. These are great, and wonderful, but I 
feel they overwhelm beginner Django developers with too much.
 

>
> It will help the documentation writers. It's difficult to build on the 
>> work in the tutorial if it's not easy to get where it was. For example, a 
>> new tutorial could use the Polls application to tackle logging or static 
>> files - which is what I would like to start doing now - but it's quite a 
>> bore to have to go through all the steps in all the previous tutorials just 
>> so you can start writing it.
>>
>
> I'm definitely not convinced by this. Anyone who is in a position to be 
> writing documentation should *definitely* be able to wrap their head around 
> enough version control to handle this sort of thing, or be sufficiently 
> expert to rebuild the tutorial in a couple of minutes.
>

This is a fact.

In August, when we worked on refactor of page 3 of the tutorial Dave and I 
spent about 5 minutes setting up things to match. The real spent was 
gathering feedback from beginners to find their pain points with the 
tutorial.
 

>  
>
>> I think it would be worthwhile having an official repository for this 
>> purpose.
>>
>  
> Thanks for the feedback. I'm still not convinced, but I'm always 
> interested to hear the opinion of others. Eventually, someone (or the 
> weight of public opinion) might convince me to change my mind
>

I'm completely with Russ. Scratch that, I feel much stronger about this 
issue then he does. 

Zed Shaw, with LPTHW, has proven that by forcing people to type stuff out 
they learn better. You don't learn by copy/pasting or checking against a 
working implementation. It's not always fun to learn this way, but learning 
software development is a process of doing.

There are other places the tutorial needs improvement besides an official 
working implementation of the app. Off the top of my head here are a couple 
of items:

1. The new tutorial intros are nice but missing some pieces. I'll document 
this in tickets soon.
2. Page 2 of the tutorial is too long. People start copy/pasting very 
early, and attempts to teach the tutorial as a class always bog down on 
page 2. I would like to make this page shorter and move most of it to new 
intro page.

Daniel Greenfeld

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view 

Re: make the source code of the django tutorial available ?

2013-01-16 Thread Russell Keith-Magee
Hi Daniele,

On Thu, Jan 17, 2013 at 7:07 AM, Daniele Procida wrote:

> I'm re-opening an old discussion -
> https://groups.google.com/d/topic/django-developers/MbLD1BL5xkQ/discussion.
> Sorry if it all comes out weird, I'm having to do it in Google Groups.
>
> I propose maintaining a repository of the Polls tutorial code, with each
> branch representing the state of the code at the end of each tutorial.
>
> I realise that there is a danger that people might be tempted simply to
> checkout the code rather than type it in, following all the useful steps
> and mis-steps that the tutorial provides, but at the same time it would
> have other significant advantages that it would be a shame to forego just
> in order to save people from temptation, especially if they are strongly
> warned against it.
>
>
Yes, because the best way to make sure nobody presses a button is to put a
sign over it saying "Under no circumstances press this button" :-)


> The advantages:
>
> A learner likely won't just follow the steps in the tutorial, but will
> also want to play and experiment, and break things. It will make for a
> better learning experience if that's possible with the safety-net of being
> able to return to a known good state.
>
> In particular, it will make it easier for the learner to reset their
> tutorial code so that they can go on to the next tutorial after playing
> freely with it. And sometimes, it might be weeks or months later that they
> want to do part five, or go back to have a look at some particular thing in
> it from an earlier stage.
>

I can see what you're trying to achieve here, but I'm still not convinced.

 1) The tutorials aren't that complex; even if you did have to reproduce
them from scratch, it doesn't take that long (I've done this quite a few
times, so I'm speaking from experience here).

 2) This is what version control is for. I'd much rather see someone do the
tutorial and use version control on their own repository, rather than just
pull down the latest version of a repo that contains all the code they need.

Following point 2, it might be worth suggesting that people use version
control during the tutorial. I'm not suggesting we turn the Django tutorial
into a parallel tutorial on git, but seeding the idea in people's heads has
the benefit of reinforcing best practice (you do version control everything
you do, right?), and makes it easier to work around the rollback problems
you describe; if they don't know what version control is, they might be
encouraged to go investigate, and as a result, another code-fairy gets
their wings :-)

It will help the documentation writers. It's difficult to build on the work
> in the tutorial if it's not easy to get where it was. For example, a new
> tutorial could use the Polls application to tackle logging or static files
> - which is what I would like to start doing now - but it's quite a bore to
> have to go through all the steps in all the previous tutorials just so you
> can start writing it.
>

I'm definitely not convinced by this. Anyone who is in a position to be
writing documentation should *definitely* be able to wrap their head around
enough version control to handle this sort of thing, or be sufficiently
expert to rebuild the tutorial in a couple of minutes.


> I think it would be worthwhile having an official repository for this
> purpose.
>

Thanks for the feedback. I'm still not convinced, but I'm always interested
to hear the opinion of others. Eventually, someone (or the weight of public
opinion) might convince me to change my mind.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: make the source code of the django tutorial available ?

2013-01-16 Thread Daniele Procida
I'm re-opening an old discussion - 
https://groups.google.com/d/topic/django-developers/MbLD1BL5xkQ/discussion. 
Sorry if it all comes out weird, I'm having to do it in Google Groups.

I propose maintaining a repository of the Polls tutorial code, with each 
branch representing the state of the code at the end of each tutorial.

I realise that there is a danger that people might be tempted simply to 
checkout the code rather than type it in, following all the useful steps 
and mis-steps that the tutorial provides, but at the same time it would 
have other significant advantages that it would be a shame to forego just 
in order to save people from temptation, especially if they are strongly 
warned against it.

The advantages:

A learner likely won't just follow the steps in the tutorial, but will also 
want to play and experiment, and break things. It will make for a better 
learning experience if that's possible with the safety-net of being able to 
return to a known good state. 

In particular, it will make it easier for the learner to reset their 
tutorial code so that they can go on to the next tutorial after playing 
freely with it. And sometimes, it might be weeks or months later that they 
want to do part five, or go back to have a look at some particular thing in 
it from an earlier stage.

It will help the documentation writers. It's difficult to build on the work 
in the tutorial if it's not easy to get where it was. For example, a new 
tutorial could use the Polls application to tackle logging or static files 
- which is what I would like to start doing now - but it's quite a bore to 
have to go through all the steps in all the previous tutorials just so you 
can start writing it.

I think it would be worthwhile having an official repository for this 
purpose.

Regards,

Daniele

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/qAizMhCo0iQJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: BUG:can't createsuperuser??

2013-01-16 Thread Florian Apolloner
Hi Mugisha Moses,

On Wednesday, January 16, 2013 3:09:46 PM UTC+1, Mugisha Moses wrote:
>
> http://www.joelonsoftware.com/articles/Unicode.html
>

While you surely wanted to be helpful, a link like this isn't really 
helping to solve the problem. Given the fact that the user is on windows 
and we mostly (or rather exclusively) test on Linux it's certainly possible 
that Windows is doing something stupid or the locale/sys information 
doesn't allow us to determine the encoding correctly and we have indeed a 
bug there.

Your link (at least to me) might suggest that it's completely the fault of 
the user and might be a bit discouraging to newcomers. If it's all that 
clear to you please try to include a few words to accompany the link and 
maybe even try to explain what he can do to fix this error. 

Best regards,
Florian

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/9yXdiBEQMIYJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: BUG:can't createsuperuser??

2013-01-16 Thread Florian Apolloner
Hi zhfisher,

On Wednesday, January 16, 2013 10:51:17 AM UTC+1, zhfisher wrote:
>
> Django version=1.5 rc1
> Database:mySQL
>
> E:\Work\Code\Django\SaleTools>manage.py createsuperuser
> D:\Python27\lib\site-packages\django\utils\hashcompat.py:9: 
> DeprecationWarning:
> django.utils.hashcompat is deprecated; use hashlib instead
>   DeprecationWarning)
>
> UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: 
> ordin
> al not in range(128)
>

Can you tell me what exactly you executed? just manage.py createsuperuser 
and did it fail immediately or  after you entered the username?
 

> In pycharm 2.6:
>

I can't tell you what pycharm does, according to the docs it is certainly 
supported: 
https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-createsuperuser
 
and works for me.

Thx,
Florian

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/NRxMd-vyOo4J.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: BUG:can't createsuperuser??

2013-01-16 Thread mugisha moses
http://www.joelonsoftware.com/articles/Unicode.html

On Wed, Jan 16, 2013 at 12:51 PM, zhfisher  wrote:

> Django version=1.5 rc1
> Database:mySQL
>
>
> E:\Work\Code\Django\SaleTools>manage.py createsuperuser
> D:\Python27\lib\site-packages\django\utils\hashcompat.py:9:
> DeprecationWarning:
> django.utils.hashcompat is deprecated; use hashlib instead
>   DeprecationWarning)
>
> UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1:
> ordin
> al not in range(128)
>
>
> In pycharm 2.6:
>
>Usage: E:\Work\Code\Django\SaleTools\manage.py createsuperuser
> [options]
>
> Used to create a superuser.
>
> E:\Work\Code\Django\SaleTools\manage.py: error: no such option: --username
>
>
>
> Whether this is a bug?
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-developers/-/2eNvneWMRAgJ.
> To post to this group, send email to django-developers@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



BUG:can't createsuperuser??

2013-01-16 Thread zhfisher
Django version=1.5 rc1
Database:mySQL


E:\Work\Code\Django\SaleTools>manage.py createsuperuser
D:\Python27\lib\site-packages\django\utils\hashcompat.py:9: 
DeprecationWarning:
django.utils.hashcompat is deprecated; use hashlib instead
  DeprecationWarning)

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: 
ordin
al not in range(128)


In pycharm 2.6:

   Usage: E:\Work\Code\Django\SaleTools\manage.py createsuperuser [options] 

Used to create a superuser.

E:\Work\Code\Django\SaleTools\manage.py: error: no such option: --username



Whether this is a bug?


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/2eNvneWMRAgJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.