Re: Internationalization

2011-09-22 Thread Mike Dewhirst

On 23/09/2011 1:45am, nadae ivar wrote:

i check it but not undestand


It takes a bit of study and much concentration. I tried it understand it 
myself recently and posed some questions here and got some very good 
answers and had my understandings corrected at the time. I still haven't 
implemented Internationalization but wrote myself an overview (below) so 
I would remember it. It is unfinished and has not been proof-read by an 
expert. So if you use it I would appreciated your feedback and any 
corrections you feel ought to be made. Here goes ...


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - - - - - - -

Howto - internationalization in your own projects

Objective:

Deploy a Django driven website (consisting of multiple Django apps) 
across as many regions as possible but in only a couple of languages.


Overview:

Your Django website consists of server-side software, a database of 
information used in your site plus (probably) client-side javascript 
software.


To satisfy the "as many regions" part of the objective, you hardly need 
to do anything. Django comes with those regional number and date-format 
batteries included. Just switch it on with settings.USE_L10N = True. 
This is called "localization" - which is part of internationalization 
and which also needs to be switched on with USE_I18N = True.


If that is all you do, people in far off lands speaking different 
languages and recognising local date and number formats will be more or 
less happy. They will be happy about the formats but less happy to see 
some screen text in their own language and the rest in your language.


Note - You can restrict the languages from all and sundry to just those 
you want with a LANGUAGES setting. See 
django.conf.global_settings.LANGUAGES to see the full range. Copy a 
LANGUAGES subset into your own settings.py to override this.


The Django team has already translated its own literals into multitudes 
of languages. These cover everything Django itself emits which you see. 
Similarly, most of the contrib apps also have their literals translated too.


To satisfy the "couple of languages" part of the above objective, you 
need to similarly translate any literals in your software into the other 
languages you have chosen.


Howto:

1. In settings.py switch on USE_L10N and USE_I18N

Note - USE_L10N == True makes Django use 
django.conf.locale..formats to display numbers, dates and so 
on. Otherwise, the formats in django.conf.global_settings are used instead.


But how does Django know which locale's format to use? Answer: The 
browser request contains locale settings which are detected by locale 
middleware (see below) so that the correct date and number formats are 
used. See 
https://docs.djangoproject.com/en/dev/topics/i18n/localization/#format-localization


Note - USE_I18N == True is necessary to give effect to USE_L10N. It also 
enables all the Django (and contrib app) screen text translations for 
all the regions as mentioned in the overview above.


But how does Django know which locale to use? Answer: The browser 
request contains a language code from the user's locale. If there is a 
translation for that language AND it is enabled (see next point below) 
it will be used.



2. In settings.py, optionally restrict the languages to your chosen ones 
like this example ...


gettext = lambda s: s  # this is a do-nothing workaround against 
circular imports


LANGUAGES = (
('fr', gettext('French')),
('en', gettext('English')),
)


3. In settings.py install Django's localization middleware 
django.middleware.locale.LocaleMiddleware


Note - In settings.py near the top of the installed middleware the 
following sequence should be observed ...


   'django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.locale.LocaleMiddleware',
   'django.middleware.common.CommonMiddleware',

4. Finish your application to the point that screen and print literals 
are stable in your own language.


5. For each app used in your site create a "locale" directory with 
separate language sub-directories for each of the languages you want to 
translate. These sub-directories will contain your translated screen 
literals for each app. If your separate apps are intended for release 
into the wild it is very important for each to have its own locale 
directory for translations.


Note - See the locale language subdirectories in 
django.contrib.admin.locale as a guide. If the language you want isn't 
there, visit http://www.w3.org/International/articles/language-tags/ and 
work out what your language sub-directory name should be.


Note - The "locale" directory doesn't have to be located in each app 
directory. It - or they - can be anywhere else provided you nominate the 
location in settings.LOCALE_PATHS. If there was a lot of common screen 
and print text between the apps you might decide to keep everything 
together in a single directory listed in LOCALE_PATHS. You 

Re: Upload permissions

2011-09-22 Thread Robert Steckroth
Allright, I fixed it.
This did the trick -->
destination = open(settings.MEDIA_ROOT+'userAvatarDir/'+fName, 'wb+')


On Thu, Sep 22, 2011 at 9:55 PM, Robert Steckroth  wrote:

> Hey Gang, I have created a simple user profile area with  an Avatar
> image upload system. It works great on my localhost but gives a
> permission error on the server. Has anyone ran into this and found a quick
> answer?
> The upload media url is a wsgi process and is not used in the file.open()
> command.
> The directory permissions are the same as well. Got to be some cookie thing
> but
> I tried clearing all cookies and cache off the Browser. Here is the error
> line break -->
> destination = open('/home/radioweedshow/uploads/userAvatarDir/'+fName,
> 'wb+')
> IOError at /startUpload/
>
> [Errno 13] Permission denied: 
> u'/home/radioweedshow/uploads/userAvatarDir/surgemcgeenewHeader1.jpg'
>
>  Request Method: POST  Request URL:
> http://www.radioweedshow.com/startUpload/  Django Version: 1.3  Exception
> Type: IOError  Exception Value:
>
> [Errno 13] Permission denied: 
> u'/home/radioweedshow/uploads/userAvatarDir/surgemcgeenewHeader1.jpg'
>
>  Exception Location: /home/radioweedshow/radio/member/memberViews.py in
> handle_uploaded_file, line 31  Python Executable: /usr/bin/python  Python
> Version: 2.6.5  Python Path:
>
> ['/usr/lib/python2.6',
>  '/usr/lib/python2.6/plat-linux2',
>  '/usr/lib/python2.6/lib-tk',
>  '/usr/lib/python2.6/lib-old',
>  '/usr/lib/python2.6/lib-dynload',
>  '/usr/lib/python2.6/dist-packages',
>  '/usr/lib/pymodules/python2.6',
>  '/usr/lib/pymodules/python2.6/gtk-2.0',
>  '/usr/local/lib/python2.6/dist-packages',
>
>
> --
> Bringing game to younix
> Bust0ut Entertainment  ---
> PBDefence.com
> "Finding the exit without looking"
>



-- 
Bringing game to younix
Bust0ut Entertainment  ---
PBDefence.com
"Finding the exit without looking"

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



Re: Is Satchmo a good framework?

2011-09-22 Thread Renato Beserra
Thank you very much for the answers.

Kenneth, i took a look at satchless but i think satchmo will fit my
porpouses better. But knowing it is 100% Django is really useful:).

Bill,

Good to know of this lack of flexibility. But thankfully the point 1 you
mentioned, won't be a problem and 2. i will have to code anyway, since we
are gonna use a brazilian payment service.


2011/9/22 Bill Freeman 

> On Thu, Sep 22, 2011 at 7:56 AM, kenneth gonsalves
>  wrote:
> > On Thu, 2011-09-22 at 08:45 -0300, Renato Beserra wrote:
> >> 1) Is satchmo a good choice for a simple project?
> >
> > it is good - but for a simple project you may may also look at
> > satchless.
> >>
> >> 2) How different is it from a regular django app? I mean, will my
> >> Django background - and code - be useful?  Do they build some kind of
> >> abstraction layer on top of it?
> >>
> >
> > it is a regular django project - so your django knowledge will come in
> > handy.
> > --
> > regards
> > Kenneth Gonsalves
>
> I have to agree that it is good.  It has been a while (in software
> development
> terms) so things may have improved, but my nits were:
>
> 1. If the customer wants something unusual, such as a funky quantity
> discount
> structure, the mods were tougher than I would have hoped (had to fight the
> structure a little).
>
> 2. All of the payment methods offered involved handling credit card numbers
> on
> site and passing them to a processer (Authorize.net, for example), rather
> than
> using the scheme where at checkout you redirect to the processor, who,
> possibly
> using your logo and colors, takes the card number while displaying an item
> list
> and price summary, then contacts you on a back channel to say that the
> order
> has been paid, and redirects the customer to your designated thank you
> page.
> Keeping the credit card numbers off of the site makes PCI (payment
> card industry)
> compliance much simpler.
>
> Bill
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Renato Beserra Sousa

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



Upload permissions

2011-09-22 Thread Robert Steckroth
Hey Gang, I have created a simple user profile area with  an Avatar
image upload system. It works great on my localhost but gives a
permission error on the server. Has anyone ran into this and found a quick
answer?
The upload media url is a wsgi process and is not used in the file.open()
command.
The directory permissions are the same as well. Got to be some cookie thing
but
I tried clearing all cookies and cache off the Browser. Here is the error
line break -->
destination = open('/home/radioweedshow/uploads/userAvatarDir/'+fName,
'wb+')
IOError at /startUpload/

[Errno 13] Permission denied:
u'/home/radioweedshow/uploads/userAvatarDir/surgemcgeenewHeader1.jpg'

 Request Method: POST  Request URL:
http://www.radioweedshow.com/startUpload/  Django Version: 1.3  Exception
Type: IOError  Exception Value:

[Errno 13] Permission denied:
u'/home/radioweedshow/uploads/userAvatarDir/surgemcgeenewHeader1.jpg'

 Exception Location: /home/radioweedshow/radio/member/memberViews.py in
handle_uploaded_file, line 31  Python Executable: /usr/bin/python  Python
Version: 2.6.5  Python Path:

['/usr/lib/python2.6',
 '/usr/lib/python2.6/plat-linux2',
 '/usr/lib/python2.6/lib-tk',
 '/usr/lib/python2.6/lib-old',
 '/usr/lib/python2.6/lib-dynload',
 '/usr/lib/python2.6/dist-packages',
 '/usr/lib/pymodules/python2.6',
 '/usr/lib/pymodules/python2.6/gtk-2.0',
 '/usr/local/lib/python2.6/dist-packages',


-- 
Bringing game to younix
Bust0ut Entertainment  ---
PBDefence.com
"Finding the exit without looking"

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



Re: Help me understand the django.request logger

2011-09-22 Thread Russell Keith-Magee
On Fri, Sep 23, 2011 at 5:56 AM, Roy Smith  wrote:
> Ugh, I got it figured out.  I totally misunderstood what the docs were
> saying.  I was thinking that somehow the django.request logger
> magically found the request object and stuck it into the context.
> That's not what it was saying at all.  All the quote from the docs
> really means is that all the places inside of django where
> django.request is used, the request is explicitly passed in as part of
> extra.
>
> Sigh.

Hi Roy,

I'm glad you were able to work this out for yourself. If you want to
be really helpful here, you could turn what you've learned into an
improvement in the docs. Old-timers (like myself) often forget what is
obvious and what is assumed knowledge, but since we are the ones
writing the docs, we sometimes forget to include a pertinent detail.
If you're new to a framework (or new to a particular area of a
framework) you're often the best person to provide feedback on
problems in the docs.

So - if you want to be really helpful, open a ticket [1] describing
the aspect of the docs that was confusing, either by ommision or as a
result of phrasing. Suggest some improved phrasing, or indicate the
detail that is missing. If you're really keen, try working up a patch
that implements your changes.

[1] https://code.djangoproject.com/newticket

Yours,
Russ Magee %-)

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



Re: Help me understand the django.request logger

2011-09-22 Thread Roy Smith
Ugh, I got it figured out.  I totally misunderstood what the docs were
saying.  I was thinking that somehow the django.request logger
magically found the request object and stuck it into the context.
That's not what it was saying at all.  All the quote from the docs
really means is that all the places inside of django where
django.request is used, the request is explicitly passed in as part of
extra.

Sigh.

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



Can you trigger a forms style error from a view?

2011-09-22 Thread John Shaver
I'm designing a user registration form for my app.  I need to verify
that the username they're using is not already in use before trying to
create the user.  If the username already exists, I want to be able to
generate a form style error that says "Sorry that username is already
in use."

The only way I could find to do is with 'raise ValidationError'()' in
the clean() function.  However, trying to query my User model to see
if that username is already take does not work from the clean()
function.  On the other hand, I cannot find a way to set the error in
the form object from inside the view.

I prefer to do this from inside of the view, rather than from the
clean function.  I already have several validation rules there that I
created, but I'd prefer to keep the Form class separate from my
models.   Any suggestions?

-John

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



Re: Django tutorials

2011-09-22 Thread Gustavo Velazquez
thank's


El día 22 de septiembre de 2011 15:21, Mengu  escribió:
> django from the ground up series is good.
>
> watch at http://showmedo.com/videotutorials/series?name=PPN7NA155
>
> On Sep 22, 8:18 am, ANKUR AGGARWAL  wrote:
>> Hey
>> I am currently searching for django video tutorials. I am unable to find
>> them on web. Was expecting them at lynda.com but they doesn't provide any
>> type of django tuts. So please provide me the links :)
>> Thanks in advance :)
>>
>> Regards
>> Ankur Aggarwal
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Dealing with misc parts of a project

2011-09-22 Thread Simon Connah

On 22/09/2011 19:50, DrBloodmoney wrote:

On Thu, Sep 22, 2011 at 12:30 PM, Micky Hulse  wrote:

On Thu, Sep 22, 2011 at 8:54 AM, Simon Connah  wrote:

So do you just tend to create a new misc app to hold all these little bits and 
pieces or is there a convention for such things?

For a few projects at work, we use a "global" app that contains code
for use in other apps.


Very similar. I think that a lot of people use a 'core' app. It's what
I use and where I dump a lot of models and utilities/forms that cannot
be separated from the project itself. It's where I'll put profiles and
account routing, about pages, etc.

Ah good. At least I am following convention then with the only 
difference that I tend to put project specific stuff in an app called misc.


This is one of the areas that I think Django could do with improving on. 
You might not have enough functionality to justify turning it into a 
complete application but you still want to keep it clean and tidy somewhere.


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



Re: Programming logic in Classed Based FormView or in the Form Itself?

2011-09-22 Thread DrBloodmoney
On Thu, Sep 22, 2011 at 11:14 AM, Kurtis  wrote:
> Hey,
>
> I'm trying to figure out the best way to do this. I have a FormView
> and an associated Form. In my Form, I take care of all of the
> validation and cleaning as far as the input goes.
>
> However, I need to put in some more logic such as saving the user,
> logging in a user, and whatever else the future holds. I can do this
> in my Class Based View just fine within the is_valid() method.
>
> The problem comes when I need to raise an exception. I'm not sure what
> kind of an exception to raise or how to present it back to the user.
> For example, if a user tries to create an account and the email
> address is already in use, I want to be able to display that message
> to them with the form.
>
> I know that authentication is a bad example on this since most of this
> really could be done from the Form. But I have a feeling that in the
> future there will be places I need to actually do this stuff from the
> View itself.
>
> Are there any suggestions on a good, or conventional, way to do this?
> Basically it boils down to this -- with Class Based FormViews, should
> the logic for *everything* be pushed into the Form itself? Or should
> it be split up between the Form (validation) and the View (everything
> else) like I am trying to do?
>
> Any examples would also be very helpful!
>
> Thanks


I keep all but the most simple of logic (actually I try to not have
*any* logic in views or templates). It doesn't belong there. I don't
think that django's docs make a strong statement about where it should
go, but I think it should go into models (for model instance specific
logic), a model manager (for whole-table related logic) and in the
forms (for CRUD-type logic). A basic example is that I will add a
save() method to every forms.Form that I write (to mimic the
forms.ModelForm api):

class TestForm(forms.Form):
field
field2
field3

def __init__(self, dependency, *args, **kwargs):
self.dependency = dependency
super(TestForm, self).__init__(*args, **kwargs)

def clean_field(self):  
def clean(self): 

def save(self):
self.cleaned_data['field']
do some fancy logic

# in view:
... boilerplate
if request.POST:
 form = TestForm(dependency, data=request.POST)
 if form.is_valid():
form.save()
return redirect()
 # failed validation
 return render(request, template, {'form': form})

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



Help me understand the django.request logger

2011-09-22 Thread Roy Smith
I'm running django 1.3, python 2.6.  I'm trying to write a custom
formatter for the django.request logger.  I need to log one of the
headers from the HTTP request.  The documentation for django.request
(https://docs.djangoproject.com/en/1.3/topics/logging/) says:

Messages to this logger have the following extra context:

status_code: The HTTP response code associated with the request.
request: The request object that generated the logging message.

It's not entirely clear what "extra context" means, but I'm assuming
the record passed to my format() method will include those
attributes.  It doesn't.  My formatter looks like:

class UniqueRequestIdFormatter(logging.Formatter):
def format(self, record):
record.message = record.msg % record.args
record.asctime = self.formatTime(record)
format = '%(asctime)s: %(name)s %(levelname)s %(funcName)s %
(message)s'
pprint.pprint(record.__dict__)
return format % record.__dict__

When I log something to this, it prints:

{'args': (),
 'asctime': '2011-09-22 14:54:53,755',
 'created': 1316717693.7554641,
 'exc_info': None,
 'exc_text': None,
 'filename': 'views.py',
 'funcName': 'listen_content',
 'levelname': 'DEBUG',
 'levelno': 10,
 'lineno': 253,
 'message': u"slug = 'essential-motown-hits-songza'",
 'module': 'views',
 'msecs': 755.46407699584961,
 'msg': u"slug = 'essential-motown-hits-songza'",
 'name': 'django.request',
 'pathname': '/home/roy/src/default/djsite/djfront/views.py',
 'process': 18113,
 'processName': 'MainProcess',
 'relativeCreated': 16236.304044723511,
 'thread': 48007945393920,
 'threadName': 'Dummy-1'}

How do I get access to the request object?

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



Re: Dealing with misc parts of a project

2011-09-22 Thread DrBloodmoney
On Thu, Sep 22, 2011 at 12:30 PM, Micky Hulse  wrote:
> On Thu, Sep 22, 2011 at 8:54 AM, Simon Connah  
> wrote:
>> So do you just tend to create a new misc app to hold all these little bits 
>> and pieces or is there a convention for such things?

>
> For a few projects at work, we use a "global" app that contains code
> for use in other apps.
>

Very similar. I think that a lot of people use a 'core' app. It's what
I use and where I dump a lot of models and utilities/forms that cannot
be separated from the project itself. It's where I'll put profiles and
account routing, about pages, etc.

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



Re: Django tutorials

2011-09-22 Thread Mengu
django from the ground up series is good.

watch at http://showmedo.com/videotutorials/series?name=PPN7NA155

On Sep 22, 8:18 am, ANKUR AGGARWAL  wrote:
> Hey
> I am currently searching for django video tutorials. I am unable to find
> them on web. Was expecting them at lynda.com but they doesn't provide any
> type of django tuts. So please provide me the links :)
> Thanks in advance :)
>
> Regards
> Ankur Aggarwal

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



Re: Is Satchmo a good framework?

2011-09-22 Thread Bill Freeman
On Thu, Sep 22, 2011 at 7:56 AM, kenneth gonsalves
 wrote:
> On Thu, 2011-09-22 at 08:45 -0300, Renato Beserra wrote:
>> 1) Is satchmo a good choice for a simple project?
>
> it is good - but for a simple project you may may also look at
> satchless.
>>
>> 2) How different is it from a regular django app? I mean, will my
>> Django background - and code - be useful?  Do they build some kind of
>> abstraction layer on top of it?
>>
>
> it is a regular django project - so your django knowledge will come in
> handy.
> --
> regards
> Kenneth Gonsalves

I have to agree that it is good.  It has been a while (in software development
terms) so things may have improved, but my nits were:

1. If the customer wants something unusual, such as a funky quantity discount
structure, the mods were tougher than I would have hoped (had to fight the
structure a little).

2. All of the payment methods offered involved handling credit card numbers on
site and passing them to a processer (Authorize.net, for example), rather than
using the scheme where at checkout you redirect to the processor, who, possibly
using your logo and colors, takes the card number while displaying an item list
and price summary, then contacts you on a back channel to say that the order
has been paid, and redirects the customer to your designated thank you page.
Keeping the credit card numbers off of the site makes PCI (payment
card industry)
compliance much simpler.

Bill

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



Re: Programming logic in Classed Based FormView or in the Form Itself?

2011-09-22 Thread Xavier Ordoquy
Hi,

Nothing prevents you to put your tests in the form_valid and render the same 
page with your errors.

Regards,
Xavier,
Linovia.

Le 22 sept. 2011 à 17:14, Kurtis a écrit :

> Hey,
> 
> I'm trying to figure out the best way to do this. I have a FormView
> and an associated Form. In my Form, I take care of all of the
> validation and cleaning as far as the input goes.
> 
> However, I need to put in some more logic such as saving the user,
> logging in a user, and whatever else the future holds. I can do this
> in my Class Based View just fine within the is_valid() method.
> 
> The problem comes when I need to raise an exception. I'm not sure what
> kind of an exception to raise or how to present it back to the user.
> For example, if a user tries to create an account and the email
> address is already in use, I want to be able to display that message
> to them with the form.
> 
> I know that authentication is a bad example on this since most of this
> really could be done from the Form. But I have a feeling that in the
> future there will be places I need to actually do this stuff from the
> View itself.
> 
> Are there any suggestions on a good, or conventional, way to do this?
> Basically it boils down to this -- with Class Based FormViews, should
> the logic for *everything* be pushed into the Form itself? Or should
> it be split up between the Form (validation) and the View (everything
> else) like I am trying to do?
> 
> Any examples would also be very helpful!
> 
> Thanks
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Re: Dealing with misc parts of a project

2011-09-22 Thread Micky Hulse
On Thu, Sep 22, 2011 at 8:54 AM, Simon Connah  wrote:
> So do you just tend to create a new misc app to hold all these little bits 
> and pieces or is there a convention for such things?

I asked a similar question here:



For a few projects at work, we use a "global" app that contains code
for use in other apps.

I am looking forward to hear what others have to say. :)

Thanks!
Micky

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



Re: User Registration -> Password not saving

2011-09-22 Thread Kurtis Mullins
I was wrong. There wasn't any issue with the unicode. Your fixed worked
perfectly. I just had to change my comparison from

password is not password_confirm

to

password != password_confirm

and it's working great now. Thanks a lot!

On Thu, Sep 22, 2011 at 12:04 PM, Kurtis Mullins
wrote:

> Thanks Daniel! You were right on cue with that. I tried your code and for
> some reason the value is being returned as a standard string instead of a
> unicode string, as far as I can tell. (Effectively, my password and
> passwordConfirm are not matching anymore). Hopefully once I get that worked
> out, things will be working great.
>
>
> On Thu, Sep 22, 2011 at 11:56 AM, Daniel Roseman wrote:
>
>> On Thursday, 22 September 2011 15:18:15 UTC+1, Kurtis wrote:
>>>
>>> Sorry, I guess I should've posted that as well :)
>>>
>>> import string
>>> class PasswordField(forms.CharField)**:
>>>
>>> # Setup the Field
>>> def __init__(self, *args, **kwargs):
>>> super(PasswordField, self).__init__(min_length = 7, required =
>>> True,
>>> label = u'Password',
>>> widget = forms.PasswordInput(render_**value =
>>> False),
>>> *args, **kwargs)
>>>
>>> # Validate - 1+ Numbers, 1+ Letters
>>> def clean (self, value):
>>>
>>> # Setup Our List of Characters
>>> lower = list(string.lowercase[:26])
>>> upper = list(string.uppercase[:26])
>>> numbers = [str(i) for i in range(10)]
>>>
>>> # Assume False until Proven Otherwise
>>> numCheck = False
>>> charCheck = False
>>>
>>> # Loop until we Match
>>> for char in value:
>>> if not charCheck:
>>> if char in lower or char in upper:
>>> charCheck = True
>>> if not numCheck:
>>> if char in numbers:
>>> numCheck = True
>>> if numCheck and charCheck:
>>> break
>>>
>>> if not numCheck or not charCheck:
>>> raise forms.ValidationError(u'Your password must include at
>>> least \
>>>   **one letter and at least one
>>> number.')
>>>
>>>
>> You need to ensure that it returns the value if it is valid. Currently,
>> your code raises an error if it is invalid, but returns `None` if it is
>> valid - you should explicitly return `value`.
>> Actually, even better, you should call the superclass `clean` method and
>> return the value from that:
>> return super(PasswordField, self).clean(value)
>> --
>> DR.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/96liwPhxphwJ.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

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



Re: User Registration -> Password not saving

2011-09-22 Thread Kurtis Mullins
Thanks Daniel! You were right on cue with that. I tried your code and for
some reason the value is being returned as a standard string instead of a
unicode string, as far as I can tell. (Effectively, my password and
passwordConfirm are not matching anymore). Hopefully once I get that worked
out, things will be working great.

On Thu, Sep 22, 2011 at 11:56 AM, Daniel Roseman wrote:

> On Thursday, 22 September 2011 15:18:15 UTC+1, Kurtis wrote:
>>
>> Sorry, I guess I should've posted that as well :)
>>
>> import string
>> class PasswordField(forms.CharField)**:
>>
>> # Setup the Field
>> def __init__(self, *args, **kwargs):
>> super(PasswordField, self).__init__(min_length = 7, required =
>> True,
>> label = u'Password',
>> widget = forms.PasswordInput(render_**value =
>> False),
>> *args, **kwargs)
>>
>> # Validate - 1+ Numbers, 1+ Letters
>> def clean (self, value):
>>
>> # Setup Our List of Characters
>> lower = list(string.lowercase[:26])
>> upper = list(string.uppercase[:26])
>> numbers = [str(i) for i in range(10)]
>>
>> # Assume False until Proven Otherwise
>> numCheck = False
>> charCheck = False
>>
>> # Loop until we Match
>> for char in value:
>> if not charCheck:
>> if char in lower or char in upper:
>> charCheck = True
>> if not numCheck:
>> if char in numbers:
>> numCheck = True
>> if numCheck and charCheck:
>> break
>>
>> if not numCheck or not charCheck:
>> raise forms.ValidationError(u'Your password must include at
>> least \
>>   **one letter and at least one
>> number.')
>>
>>
> You need to ensure that it returns the value if it is valid. Currently,
> your code raises an error if it is invalid, but returns `None` if it is
> valid - you should explicitly return `value`.
> Actually, even better, you should call the superclass `clean` method and
> return the value from that:
> return super(PasswordField, self).clean(value)
> --
> DR.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/96liwPhxphwJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Internationalization

2011-09-22 Thread Andres Reyes
If you could provide more information as to what you don't understand and
what have you tried so far we could be of more assistance

2011/9/22 nadae ivar 

> i check it but not undestand
>
> On Sep 22, 10:40 am, Maksymus007  wrote:
> > and of course you did check django documentation under
> internationalization
> > section?:)
> >
> > Pozdrawiam, Maksymilian Pawlak
> > 22-09-2011 12:30 użytkownik "nadae ivar"  napisał:>
> hi,
> > > i have a application in french i wanna use internationalization to
> > > change language at each request if the broswer in english turn it in
> > > english if the broser in french turn it in french
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> >
> > "Django users" group.> To post to this group, send email to
> django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> >
> > django-users+unsubscr...@googlegroups.com.> For more options, visit this
> group at
> >
> > http://groups.google.com/group/django-users?hl=en.
> >
> >
> >
> >
> >
> >
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

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



Re: User Registration -> Password not saving

2011-09-22 Thread Daniel Roseman
On Thursday, 22 September 2011 15:18:15 UTC+1, Kurtis wrote:
>
> Sorry, I guess I should've posted that as well :)
>
> import string
> class PasswordField(forms.CharField):
> 
> # Setup the Field
> def __init__(self, *args, **kwargs):
> super(PasswordField, self).__init__(min_length = 7, required = 
> True,
> label = u'Password',
> widget = forms.PasswordInput(render_value = 
> False),   
> *args, **kwargs)
> 
> # Validate - 1+ Numbers, 1+ Letters
> def clean (self, value):
> 
> # Setup Our List of Characters
> lower = list(string.lowercase[:26])
> upper = list(string.uppercase[:26])
> numbers = [str(i) for i in range(10)]
> 
> # Assume False until Proven Otherwise
> numCheck = False
> charCheck = False
>
> # Loop until we Match
> for char in value: 
> if not charCheck:
> if char in lower or char in upper:
> charCheck = True
> if not numCheck:
> if char in numbers:
> numCheck = True
> if numCheck and charCheck:
> break
> 
> if not numCheck or not charCheck:
> raise forms.ValidationError(u'Your password must include at 
> least \
>   one letter and at least one 
> number.')
>
>
You need to ensure that it returns the value if it is valid. Currently, your 
code raises an error if it is invalid, but returns `None` if it is valid - 
you should explicitly return `value`.
Actually, even better, you should call the superclass `clean` method and 
return the value from that:
return super(PasswordField, self).clean(value)
--
DR.
 

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



Dealing with misc parts of a project

2011-09-22 Thread Simon Connah
When writing a project in Django it is a common occurrence that there are some 
small elements that must be shared between all applications in the project but 
that do not fit within the context of any of the apps as it would break 
encapsulation. I'm thinking about things such as terms and conditions pages 
(which admittedly could use the flat pages mechanism but that does not offer 
quite the same level of control as I am looking for) and privacy policies.

So do you just tend to create a new misc app to hold all these little bits and 
pieces or is there a convention for such things?

Thanks,
Simon.

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



Re: Https with runserver

2011-09-22 Thread Bjarni Rúnar Einarsson
Following up to myself (sorry for the spam) - please replace
"yourname" with something you invented yourself. Everyone signing up
for yourname.pagekite.me is really not going to work very well. :-)

2011/9/22 Bjarni Rúnar Einarsson :
> Another way, would be to use PageKite. The service provides a wildcard
> SSL cert for all *.pagekite.me names.  From the command line:
>
>   curl http://pagekite.net/pk/pagekite-0.4.py >pagekite.py
>   python pagekite.py 8000 yourname.pagekite.me
>
> Answer the account creation questions and then go to
> https://yourname.pagekite.me/ - whatever is on port 8000 should be
> visible.  If you want to quickly password protect it so your dev work
> isn't open to the world, do this instead:
>
>   python pagekite.py 8000 yourname.pagekite.me +password/user=secret
>
> (disclaimer: I made this! I love feedback. :-)
>
> On Thu, Sep 15, 2011 at 12:52 AM, Gelonida N  wrote:
>> On 09/15/2011 01:44 AM, Russell Keith-Magee wrote:
>>> 2011/9/14 Simon Bächler :
 Any news considering HTTPS and runserver?
>>>
>>> What "News" are you expecting?
>>>
>>> The Django project has made no secret of the fact that we don't
>>> consider runserver to be a "real" webserver. It isn't intended for
>>> production use. We haven't spent any time or effort auditing it for
>>> production use. It is missing many key features that a "real"
>>> webserver needs to have.
>>>
>>> runserver is intended to be the bare minimum necessary to support
>>> local development. If you have nontrivial needs, you should be looking
>>> at alternative options for local development.
>>>
>>> Yours,
>>> Russ Magee %-)
>>>
>> You can also create a minimalist https server with python twisted
>> (and the openssl module)
>>
>> You just need  additional url rules, such, that django is also serving
>> /static amd /media directories:
>>
>>
>> just set PYTHONPATH
>> and
>> DJANGO_SETTINGS_MODULE
>> as needed,
>>
>> create a file named django_wrapper.py with following contents:
>> #  File starts here ##
>> from django.core.handlers.wsgi import WSGIHandler
>>
>> application=WSGIHandler()
>> #  end of file #
>>
>> and call then
>>
>> twistd -n web --https $HTTPS_PORT -p $HTTP_PORT \
>> --certificate yourcert.crt --privkey your_cert.key \
>> --wsgi django_wrapper.application
>>
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
>
> --
> Bjarni R. Einarsson
> Founder, lead developer of PageKite.
>
> Make localhost servers visible to the world: http://pagekite.net/
>



-- 
Bjarni R. Einarsson
Founder, lead developer of PageKite.

Make localhost servers visible to the world: http://pagekite.net/

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



Re: Internationalization

2011-09-22 Thread nadae ivar
i check it but not undestand

On Sep 22, 10:40 am, Maksymus007  wrote:
> and of course you did check django documentation under internationalization
> section?:)
>
> Pozdrawiam, Maksymilian Pawlak
> 22-09-2011 12:30 użytkownik "nadae ivar"  napisał:> hi,
> > i have a application in french i wanna use internationalization to
> > change language at each request if the broswer in english turn it in
> > english if the broser in french turn it in french
>
> > --
> > You received this message because you are subscribed to the Google Groups
>
> "Django users" group.> To post to this group, send email to 
> django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
>
> django-users+unsubscr...@googlegroups.com.> For more options, visit this 
> group at
>
> http://groups.google.com/group/django-users?hl=en.
>
>
>
>
>
>
>
>

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



Programming logic in Classed Based FormView or in the Form Itself?

2011-09-22 Thread Kurtis
Hey,

I'm trying to figure out the best way to do this. I have a FormView
and an associated Form. In my Form, I take care of all of the
validation and cleaning as far as the input goes.

However, I need to put in some more logic such as saving the user,
logging in a user, and whatever else the future holds. I can do this
in my Class Based View just fine within the is_valid() method.

The problem comes when I need to raise an exception. I'm not sure what
kind of an exception to raise or how to present it back to the user.
For example, if a user tries to create an account and the email
address is already in use, I want to be able to display that message
to them with the form.

I know that authentication is a bad example on this since most of this
really could be done from the Form. But I have a feeling that in the
future there will be places I need to actually do this stuff from the
View itself.

Are there any suggestions on a good, or conventional, way to do this?
Basically it boils down to this -- with Class Based FormViews, should
the logic for *everything* be pushed into the Form itself? Or should
it be split up between the Form (validation) and the View (everything
else) like I am trying to do?

Any examples would also be very helpful!

Thanks

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



Re: Testing: create db from scratch not working

2011-09-22 Thread Leonardo Giordani
Ok, solved.

The problem was the following declaration in my models.py

current_site = Site.objects.get_current()

which tries to read the current site at registration time, before
sites has been properly filled with values.
I just replaced every use of current_site with a call to get_current()
and everything works.

Leo


2011/9/22 Leonardo Giordani :
> This is very strange for me: even flatpages depends on Site
>
> /usr/local/lib/python2.6/dist-packages/django/contrib/flatpages/models.py:from
> django.contrib.sites.models import Site
>
> but there is no problem in listing both in INSTALLED_APPS and to
> syncdb them togheter.
>
> My application depends on Site the same way
>
> manouche/models.py:from django.contrib.sites.models import Site
>
> but I cannot syncdb it with other applications.
>
> No one can help?
>
> 2011/9/22 Leonardo Giordani :
>> Sure my application depends on the site app, I'm importing Site in my 
>> models.py.
>> But manouche is already at the bottom of the list, so this does not work.
>>
>> 2011/9/22 J. Cliff Dyer :
>>> Try putting manouche at the bottom of your installed apps list. It looks
>>> like it depends on the site app being installed, but when django loads the
>>> manouche.models file, it hasn't loaded sites yet.
>>> --
>>> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>>>
>>> Leonardo Giordani  wrote:

 Hi all,

 I developed a Django application (named "manouche") using south. Thus
 I have some migrations which build my database.

 I want to setup a testing environment where I want to begin with a
 clean db, create it with syncdb, migrate my application, load current
 fixtures and run tests.

 My installed applications are

 INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.flatpages',
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'django.contrib.admin',
     'accounts',
     'south',
     'manouche',
 )

 But if I clean up the db and run "./manage.py syncdb" I get the following

 Traceback (most recent call last!
  ):

  File "./manage.py", line 14, in 
     execute_manager(settings)
   File
 "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
 line 438, in execute_manager
     utility.execute()
   File
 "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
 line 379, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File
 "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
 line 191, in run_from_argv
     self.execute(*args, **options.__dict__)
   File
 "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
 line 219, in execute
     self.validate()
   File
 "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
 line 249, in validate
     num_errors = get_validation_errors(!
  s,
 app)
   File
 "/usr/local/lib/python2.6/dist-packages/django/core/management/validation.py",
 line 36, in get_validation_errors
     for (app_name, error) in get_app_errors().items():
   File
 "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
 line 146, in get_app_errors
     self._populate()
   File
 "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
 line 61, in _populate
     self.load_app(app_name, True)
   File
 "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
 line 78, in load_app
     models = import_module('.models', app_name)
   File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py",
 line 35, in import_module
     __import__(name)
   File
 "/users/gleo/Devel/stargate/manouche/models.py", line 14, in 
     current_site = Site.objects.get_current()
   File
 "/usr/local/lib/python2.6/dist-packages/django/contrib/sites/models.py",
 line 25, in get_current
     current_site = self.get(pk=sid)
   File
 "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py",
 line 132, in get
     return self.get_query_set().get(*args, **kwargs)
   File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
 line 344, in get
     num = len(clone)
   File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
 line 82, in __len__
     self._result_cache = list(self.iterator())
   File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
 line 273, in iterator
     for row in compiler.results_iter():
   File

Re: Testing: create db from scratch not working

2011-09-22 Thread Leonardo Giordani
This is very strange for me: even flatpages depends on Site

/usr/local/lib/python2.6/dist-packages/django/contrib/flatpages/models.py:from
django.contrib.sites.models import Site

but there is no problem in listing both in INSTALLED_APPS and to
syncdb them togheter.

My application depends on Site the same way

manouche/models.py:from django.contrib.sites.models import Site

but I cannot syncdb it with other applications.

No one can help?

2011/9/22 Leonardo Giordani :
> Sure my application depends on the site app, I'm importing Site in my 
> models.py.
> But manouche is already at the bottom of the list, so this does not work.
>
> 2011/9/22 J. Cliff Dyer :
>> Try putting manouche at the bottom of your installed apps list. It looks
>> like it depends on the site app being installed, but when django loads the
>> manouche.models file, it hasn't loaded sites yet.
>> --
>> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>>
>> Leonardo Giordani  wrote:
>>>
>>> Hi all,
>>>
>>> I developed a Django application (named "manouche") using south. Thus
>>> I have some migrations which build my database.
>>>
>>> I want to setup a testing environment where I want to begin with a
>>> clean db, create it with syncdb, migrate my application, load current
>>> fixtures and run tests.
>>>
>>> My installed applications are
>>>
>>> INSTALLED_APPS = (
>>>     'django.contrib.auth',
>>>     'django.contrib.contenttypes',
>>>     'django.contrib.sessions',
>>>     'django.contrib.sites',
>>>     'django.contrib.flatpages',
>>>     'django.contrib.messages',
>>>     'django.contrib.staticfiles',
>>>     'django.contrib.admin',
>>>     'accounts',
>>>     'south',
>>>     'manouche',
>>> )
>>>
>>> But if I clean up the db and run "./manage.py syncdb" I get the following
>>>
>>> Traceback (most recent call last!
>>>  ):
>>>
>>>  File "./manage.py", line 14, in 
>>>     execute_manager(settings)
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
>>> line 438, in execute_manager
>>>     utility.execute()
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
>>> line 379, in execute
>>>     self.fetch_command(subcommand).run_from_argv(self.argv)
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
>>> line 191, in run_from_argv
>>>     self.execute(*args, **options.__dict__)
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
>>> line 219, in execute
>>>     self.validate()
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
>>> line 249, in validate
>>>     num_errors = get_validation_errors(!
>>>  s,
>>> app)
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/core/management/validation.py",
>>> line 36, in get_validation_errors
>>>     for (app_name, error) in get_app_errors().items():
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
>>> line 146, in get_app_errors
>>>     self._populate()
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
>>> line 61, in _populate
>>>     self.load_app(app_name, True)
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
>>> line 78, in load_app
>>>     models = import_module('.models', app_name)
>>>   File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py",
>>> line 35, in import_module
>>>     __import__(name)
>>>   File
>>> "/users/gleo/Devel/stargate/manouche/models.py", line 14, in 
>>>     current_site = Site.objects.get_current()
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/contrib/sites/models.py",
>>> line 25, in get_current
>>>     current_site = self.get(pk=sid)
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py",
>>> line 132, in get
>>>     return self.get_query_set().get(*args, **kwargs)
>>>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
>>> line 344, in get
>>>     num = len(clone)
>>>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
>>> line 82, in __len__
>>>     self._result_cache = list(self.iterator())
>>>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
>>> line 273, in iterator
>>>     for row in compiler.results_iter():
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
>>> line 680, in results_iter
>>>     for rows in self.execute_sql(MULTI):
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
>>> line 735, in execute_sql
>>>     cursor.execute(sql, params)
>>>   File
>>> "/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py",
>>> line 34, in execute
>>>     return self.cursor.execute(sql, params)
>>>   File
>>> 

Re: User Registration -> Password not saving

2011-09-22 Thread Kurtis Mullins
Sorry, I guess I should've posted that as well :)

import string
class PasswordField(forms.CharField):

# Setup the Field
def __init__(self, *args, **kwargs):
super(PasswordField, self).__init__(min_length = 7, required = True,
label = u'Password',
widget = forms.PasswordInput(render_value =
False),
*args, **kwargs)

# Validate - 1+ Numbers, 1+ Letters
def clean (self, value):

# Setup Our List of Characters
lower = list(string.lowercase[:26])
upper = list(string.uppercase[:26])
numbers = [str(i) for i in range(10)]

# Assume False until Proven Otherwise
numCheck = False
charCheck = False

# Loop until we Match
for char in value:
if not charCheck:
if char in lower or char in upper:
charCheck = True
if not numCheck:
if char in numbers:
numCheck = True
if numCheck and charCheck:
break

if not numCheck or not charCheck:
raise forms.ValidationError(u'Your password must include at
least \
  one letter and at least one
number.')

On Thu, Sep 22, 2011 at 4:15 AM, Daniel Roseman wrote:

>
>
> On Wednesday, 21 September 2011 23:42:02 UTC+1, Kurtis wrote:
>
>> Hey,
>>
>> I've created my own User Registration FormView. Everything seems to
>> work great except the password is always saved as "!". I can change
>> that with the "password changer" in the admin section of the site. I
>> am using an alternative authentication backend, so I'm not sure if
>> that was causing problems. I went ahead and included the default
>> authentication backend as well (at the front of the list) but that
>> didn't seem to change things. I've included my code at the bottom. Any
>> help would be greatly appreciated! Also, if there's anything wierd
>> about my code, let me know. I'm still learning.
>>
>> 
>
>
>
>> class SignUpForm(forms.Form):
>>
>> email = forms.EmailField(required = True, label = u'Email
>> Address')
>> firstName = forms.CharField(required = True)
>> lastName = forms.CharField(required = True)
>> password = PasswordField()
>> password_confirm = forms.CharField(label = u'Password
>> Confirmation',
>> widget = forms.PasswordInput(render_**value =
>> False),
>> required = True)
>>
>> 
>
>
> What is PasswordField?
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/UpH1hn6WWJwJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Https with runserver

2011-09-22 Thread Bjarni Rúnar Einarsson
Another way, would be to use PageKite. The service provides a wildcard
SSL cert for all *.pagekite.me names.  From the command line:

   curl http://pagekite.net/pk/pagekite-0.4.py >pagekite.py
   python pagekite.py 8000 yourname.pagekite.me

Answer the account creation questions and then go to
https://yourname.pagekite.me/ - whatever is on port 8000 should be
visible.  If you want to quickly password protect it so your dev work
isn't open to the world, do this instead:

   python pagekite.py 8000 yourname.pagekite.me +password/user=secret

(disclaimer: I made this! I love feedback. :-)

On Thu, Sep 15, 2011 at 12:52 AM, Gelonida N  wrote:
> On 09/15/2011 01:44 AM, Russell Keith-Magee wrote:
>> 2011/9/14 Simon Bächler :
>>> Any news considering HTTPS and runserver?
>>
>> What "News" are you expecting?
>>
>> The Django project has made no secret of the fact that we don't
>> consider runserver to be a "real" webserver. It isn't intended for
>> production use. We haven't spent any time or effort auditing it for
>> production use. It is missing many key features that a "real"
>> webserver needs to have.
>>
>> runserver is intended to be the bare minimum necessary to support
>> local development. If you have nontrivial needs, you should be looking
>> at alternative options for local development.
>>
>> Yours,
>> Russ Magee %-)
>>
> You can also create a minimalist https server with python twisted
> (and the openssl module)
>
> You just need  additional url rules, such, that django is also serving
> /static amd /media directories:
>
>
> just set PYTHONPATH
> and
> DJANGO_SETTINGS_MODULE
> as needed,
>
> create a file named django_wrapper.py with following contents:
> #  File starts here ##
> from django.core.handlers.wsgi import WSGIHandler
>
> application=WSGIHandler()
> #  end of file #
>
> and call then
>
> twistd -n web --https $HTTPS_PORT -p $HTTP_PORT \
> --certificate yourcert.crt --privkey your_cert.key \
> --wsgi django_wrapper.application
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Bjarni R. Einarsson
Founder, lead developer of PageKite.

Make localhost servers visible to the world: http://pagekite.net/

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



Re: Testing: create db from scratch not working

2011-09-22 Thread J. Cliff Dyer
Try putting manouche at the bottom of your installed apps list. It looks like 
it depends on the site app being installed, but when django loads the 
manouche.models file, it hasn't loaded sites yet.
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Leonardo Giordani  wrote:

Hi all,

I developed a Django application (named "manouche") using south. Thus
I have some migrations which build my database.

I want to setup a testing environment where I want to begin with a
clean db, create it with syncdb, migrate my application, load current
fixtures and run tests.

My installed applications are

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.flatpages',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'accounts',
'south',
'manouche',
)

But if I clean up the db and run "./manage.py syncdb" I get the following

Traceback (most recent call last):
File "./manage.py", line 14, in 
execute_manager(settings)
File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
line 438, in execute_manager
utility.execute()
File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
line 219, in execute
self.validate()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
line 249, in validate
num_errors = get_validation_errors(s, app)
File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/validation.py",
line 36, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
line 146, in get_app_errors
self._populate()
File "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
line 61, in _populate
self.load_app(app_name, True)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
line 78, in load_app
models = import_module('.models', app_name)
File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py",
line 35, in import_module
__import__(name)
File "/users/gleo/Devel/stargate/manouche/models.py", line 14, in 
current_site = Site.objects.get_current()
File "/usr/local/lib/python2.6/dist-packages/django/contrib/sites/models.py",
line 25, in get_current
current_site = self.get(pk=sid)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py",
line 132, in get
return self.get_query_set().get(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
line 344, in get
num = len(clone)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
line 82, in __len__
self._result_cache = list(self.iterator())
File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
line 273, in iterator
for row in compiler.results_iter():
File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
line 680, in results_iter
for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
line 735, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py",
line 34, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/mysql/base.py",
line 86, in execute
return self.cursor.execute(query, args)
File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 166, in execute
self.errorhandler(self, exc, value)
File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 35,
in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.DatabaseError: (1146, "Table
'stargate_devel.django_site' doesn't exist")

Where "stargate" is the name of my project.
If I remove my "manouche" application everything works fine. Then I
put in my application, run "./manage.pty migrate manouche" and be
happy.

However I do not understand why it is not working when all
applications are present in settings.py and how I can automatically
get a complete install, without having to manually remove my
application from the settings.

Any help appreciated, thank you

Leo

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


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

Re: Testing: create db from scratch not working

2011-09-22 Thread Leonardo Giordani
Sure my application depends on the site app, I'm importing Site in my models.py.
But manouche is already at the bottom of the list, so this does not work.

2011/9/22 J. Cliff Dyer :
> Try putting manouche at the bottom of your installed apps list. It looks
> like it depends on the site app being installed, but when django loads the
> manouche.models file, it hasn't loaded sites yet.
> --
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>
> Leonardo Giordani  wrote:
>>
>> Hi all,
>>
>> I developed a Django application (named "manouche") using south. Thus
>> I have some migrations which build my database.
>>
>> I want to setup a testing environment where I want to begin with a
>> clean db, create it with syncdb, migrate my application, load current
>> fixtures and run tests.
>>
>> My installed applications are
>>
>> INSTALLED_APPS = (
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.sites',
>> 'django.contrib.flatpages',
>> 'django.contrib.messages',
>> 'django.contrib.staticfiles',
>> 'django.contrib.admin',
>> 'accounts',
>> 'south',
>> 'manouche',
>> )
>>
>> But if I clean up the db and run "./manage.py syncdb" I get the following
>>
>> Traceback (most recent call last!
>>  ):
>>
>>  File "./manage.py", line 14, in 
>> execute_manager(settings)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
>> line 438, in execute_manager
>> utility.execute()
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
>> line 379, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
>> line 191, in run_from_argv
>> self.execute(*args, **options.__dict__)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
>> line 219, in execute
>> self.validate()
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
>> line 249, in validate
>> num_errors = get_validation_errors(!
>>  s,
>> app)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/validation.py",
>> line 36, in get_validation_errors
>> for (app_name, error) in get_app_errors().items():
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
>> line 146, in get_app_errors
>> self._populate()
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
>> line 61, in _populate
>> self.load_app(app_name, True)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
>> line 78, in load_app
>> models = import_module('.models', app_name)
>>   File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py",
>> line 35, in import_module
>> __import__(name)
>>   File
>> "/users/gleo/Devel/stargate/manouche/models.py", line 14, in 
>> current_site = Site.objects.get_current()
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/contrib/sites/models.py",
>> line 25, in get_current
>> current_site = self.get(pk=sid)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py",
>> line 132, in get
>> return self.get_query_set().get(*args, **kwargs)
>>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
>> line 344, in get
>> num = len(clone)
>>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
>> line 82, in __len__
>> self._result_cache = list(self.iterator())
>>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
>> line 273, in iterator
>> for row in compiler.results_iter():
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
>> line 680, in results_iter
>> for rows in self.execute_sql(MULTI):
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
>> line 735, in execute_sql
>> cursor.execute(sql, params)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py",
>> line 34, in execute
>> return self.cursor.execute(sql, params)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/backends/mysql/base.py",
>> line 86, in execute
>> return self.cursor.execute(query, args)
>>   File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 166, in
>> execute
>> self.errorhandler(self, exc, value)
>> File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 35,
>> in defaulterrorhandler
>> raise errorclass, errorvalue
>> django.db.utils.DatabaseError: (1146, "Table
>> 'stargate_devel.django_site' doesn't exist")
>>
>> Where "stargate" is the name of my project.
>> If I remove my "manouche" application everything works fine. Then I
>> put in my application, run "./manage.pty 

Testing: create db from scratch not working

2011-09-22 Thread Leonardo Giordani
Hi all,

I developed a Django application (named "manouche") using south. Thus
I have some migrations which build my database.

I want to setup a testing environment where I want to begin with a
clean db, create it with syncdb, migrate my application, load current
fixtures and run tests.

My installed applications are

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.flatpages',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'accounts',
'south',
'manouche',
)

But if I clean up the db and run "./manage.py syncdb" I get the following

Traceback (most recent call last):
  File "./manage.py", line 14, in 
execute_manager(settings)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
line 438, in execute_manager
utility.execute()
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
line 219, in execute
self.validate()
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
line 249, in validate
num_errors = get_validation_errors(s, app)
  File 
"/usr/local/lib/python2.6/dist-packages/django/core/management/validation.py",
line 36, in get_validation_errors
for (app_name, error) in get_app_errors().items():
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
line 146, in get_app_errors
self._populate()
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
line 61, in _populate
self.load_app(app_name, True)
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
line 78, in load_app
models = import_module('.models', app_name)
  File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py",
line 35, in import_module
__import__(name)
  File "/users/gleo/Devel/stargate/manouche/models.py", line 14, in 
current_site = Site.objects.get_current()
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/sites/models.py",
line 25, in get_current
current_site = self.get(pk=sid)
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py",
line 132, in get
return self.get_query_set().get(*args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
line 344, in get
num = len(clone)
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
line 82, in __len__
self._result_cache = list(self.iterator())
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
line 273, in iterator
for row in compiler.results_iter():
  File 
"/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
line 680, in results_iter
for rows in self.execute_sql(MULTI):
  File 
"/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
line 735, in execute_sql
cursor.execute(sql, params)
  File "/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py",
line 34, in execute
return self.cursor.execute(sql, params)
  File 
"/usr/local/lib/python2.6/dist-packages/django/db/backends/mysql/base.py",
line 86, in execute
return self.cursor.execute(query, args)
  File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 166, in execute
self.errorhandler(self, exc, value)
  File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 35,
in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.DatabaseError: (1146, "Table
'stargate_devel.django_site' doesn't exist")

Where "stargate" is the name of my project.
If I remove my "manouche" application everything works fine. Then I
put in my application, run "./manage.pty migrate manouche" and be
happy.

However I do not understand why it is not working when all
applications are present in settings.py and how I can automatically
get a complete install, without having to manually remove my
application from the settings.

Any help appreciated, thank you

Leo

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



Re: Django tutorials

2011-09-22 Thread Anoop Thomas Mathew
You can try peepcode.com and thinkvitamin.com . They have good quality video
tutorials. Not just django, many handy tools needed while developing for
web. One thing, they are paid.

Thanks,
Anoop Thomas Mathew
On 22 Sep 2011 16:49, "ANKUR AGGARWAL"  wrote:
> Hey
> I am currently searching for django video tutorials. I am unable to find
> them on web. Was expecting them at lynda.com but they doesn't provide any
> type of django tuts. So please provide me the links :)
> Thanks in advance :)
>
> Regards
> Ankur Aggarwal
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

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



Re: Is Satchmo a good framework?

2011-09-22 Thread kenneth gonsalves
On Thu, 2011-09-22 at 08:45 -0300, Renato Beserra wrote:
> 1) Is satchmo a good choice for a simple project? 

it is good - but for a simple project you may may also look at
satchless.
> 
> 2) How different is it from a regular django app? I mean, will my
> Django background - and code - be useful?  Do they build some kind of
> abstraction layer on top of it? 
> 

it is a regular django project - so your django knowledge will come in
handy.
-- 
regards
Kenneth Gonsalves

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



Is Satchmo a good framework?

2011-09-22 Thread Renato Beserra
Hi guys,

I have done a few django projects with complete success and now i am about
to start a simple online store.

I was considering to use some php framework, but then i saw Satchmo and its
features page convinced me to use it.

But i didn't know sactchmo before and so i would like to as you a couple of
questions:

1) Is satchmo a good choice for a simple project?

2) How different is it from a regular django app? I mean, will my Django
background - and code - be useful?  Do they build some kind of abstraction
layer on top of it?

I think that almost anything build on top of Django/Python has to be better
than some php framework, but it doesn't hurt to have a little more
information.

Thanks in Advance!


-- 
Renato Beserra Sousa

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



Re: Django tutorials

2011-09-22 Thread delegbede
Django itself has a good tut for starters except you are a video person. The 
django tutorial should get you started. 

Regards. 
Sent from my BlackBerry wireless device from MTN

-Original Message-
From: ANKUR AGGARWAL 
Sender: django-users@googlegroups.com
Date: Thu, 22 Sep 2011 10:48:29 
To: 
Reply-To: django-users@googlegroups.com
Subject: Django tutorials

Hey
I am currently searching for django video tutorials. I am unable to find
them on web. Was expecting them at lynda.com but they doesn't provide any
type of django tuts. So please provide me the links :)
Thanks in advance :)

Regards
Ankur Aggarwal

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


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



Re: Django tutorials

2011-09-22 Thread BILLION Sébastien

Le jeudi 22 septembre 2011 07:18:29, ANKUR AGGARWAL a écrit :

Hey
I am currently searching for django video tutorials. I am unable to 
find them on web. Was expecting them at lynda.com  
but they doesn't provide any type of django tuts. So please provide me 
the links :)

Thanks in advance :)

Regards
Ankur Aggarwal

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

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


hi,
google:
django dev youtube 


http://www.youtube.com/watch?v=tOMOM8QbfuY=related


--
BILLION Sébastien

the Answer to the ultimate question of life, the universe and 
everything

is 42

http://www.sebastienbillion.com/ 

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



purpose of ADMIN_MEDIA_PREFIX

2011-09-22 Thread Jibin
Hi

if i am setting up apache to serve static files(js,css,jpg,pdf,mp4) by
adding the following

Alias /media/ 'D:/Projects/Dan/Django/site_media/'

Order deny,allow
Allow from all


,should i set the variable ADMIN_MEDIA_PREFIX in settings.py.

I mean anyways any thing matching /media/ will be served by apache.
So why set ADMIN_MEDIA_PREFIX ?
Does ADMIN_MEDIA_PREFIX,MEDIA_URL etc have any purpose once I
configure apache to serve static files

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



Django tutorials

2011-09-22 Thread ANKUR AGGARWAL
Hey
I am currently searching for django video tutorials. I am unable to find
them on web. Was expecting them at lynda.com but they doesn't provide any
type of django tuts. So please provide me the links :)
Thanks in advance :)

Regards
Ankur Aggarwal

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



Re: Internationalization

2011-09-22 Thread Maksymus007
and of course you did check django documentation under internationalization
section?:)

Pozdrawiam, Maksymilian Pawlak
22-09-2011 12:30 użytkownik "nadae ivar"  napisał:
> hi,
> i have a application in french i wanna use internationalization to
> change language at each request if the broswer in english turn it in
> english if the broser in french turn it in french
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

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



Internationalization

2011-09-22 Thread nadae ivar
hi,
i have a application in french i wanna use internationalization to
change language at each request if the broswer in english turn it in
english if the broser in french turn it in french

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



Re: Admin - formset validation with counting checked elements

2011-09-22 Thread BILLION Sébastien

Le jeudi 22 septembre 2011 12:13:20, galgal a écrit :
I have my model done, the only thing is - how to validate if 1 or more 
checkboxes are checked. It should be done in admin - choices are 
displayed via Inline.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ZbU-_CGCZsEJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Sorry one more time!

add this to your admin.py

class PollAdmin(admin.ModelAdmin):
   inline =[ChoiceInline]
  #check bafore save
  def save_model(self, request, obj, form, change):
   for choice in obj.choice_set.all():
   if choice.correct == True:
   print "ok"
   obj.save()

--
BILLION Sébastien

Un geek averti en vaut 10

http://www.sebastienbillion.com/ 

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



Re: Admin - formset validation with counting checked elements

2011-09-22 Thread galgal
I have my model done, the only thing is - how to validate if 1 or more 
checkboxes are checked. It should be done in admin - choices are displayed 
via Inline.

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



Re: Admin - formset validation with counting checked elements

2011-09-22 Thread BILLION Sébastien

Le jeudi 22 septembre 2011 11:56:09, galgal a écrit :
But I need to do checks in Admin, not my view. I can't find a method 
to validate in Admin.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/rRHhnv1GGfEJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Sorry,

in models.py:

class Poll(models.Model):
   question = models.CharField(max_length=200)
   def __unicode__(self):
   return self.question

class Choice(models.Model):
   poll = models.ForeignKey(Poll)
   choice = models.CharField(max_length=200)
  correct = models.BooleanField()
   def __unicode__(self):
   return self.choice

in admin.py

class ChoiceInline(admin.TabularInline):
   model = Choice
   extra = 4

class PollAdmin(admin.ModelAdmin):
   inlines = [ChoiceInline]

admin.site.register(Poll, PollAdmin)
--
BILLION Sébastien

Un geek averti en vaut 10

http://www.sebastienbillion.com/ 

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



Re: Admin - formset validation with counting checked elements

2011-09-22 Thread galgal
But I need to do checks in Admin, not my view. I can't find a method to 
validate in Admin.

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



Re: Admin - formset validation with counting checked elements

2011-09-22 Thread BILLION Sébastien

Le jeudi 22 septembre 2011 11:42:56, galgal a écrit :
I make a mini poll system. To each question choices are related via 
FK. In admin I use Inline choices. Each choice has "correct" field 
(Boolean). When saving a poll I need to check if there is minimum 1 
choice with "correct" selected. Which function in admin I must use, to 
do that validation?


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/E_pX2IfyCBcJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Try something like that:

poll = get_object_or_404(Poll, pk=poll_id)
try:
   selected_choice = poll.choice_set.get(pk=request.POST['choice'])
   correct = selected_choice.correct
   if correct:
 do something
except (KeyError, Choice.DoesNotExist):
 
   return render_to_response('youtemplate', {

   'poll': poll,
   'error_message': "Please select a choice",
   })   


--
BILLION Sébastien

Un geek averti en vaut 10

http://www.sebastienbillion.com/ 

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



Re: changes to .py file is not reflected until server is restarted.

2011-09-22 Thread Thomas Orozco
Sightly off topic, but your .py files seem to be exposed by your webserver -
you shouldn't do this or anyone could download them!
Le 22 sept. 2011 08:02, "kenneth gonsalves"  a
écrit :
> On Wed, 2011-09-21 at 19:37 +0100, Cal Leeming [Simplicity Media Ltd]
> wrote:
>> Oh jeez - modpython, I've nfi how to make that work with the same
>> approach. Maybe check mod_python docs??
>
> apachectl graceful - no other way.
> --
> regards
> Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

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



Admin - formset validation with counting checked elements

2011-09-22 Thread galgal
I make a mini poll system. To each question choices are related via FK. In 
admin I use Inline choices. Each choice has "correct" field (Boolean). When 
saving a poll I need to check if there is minimum 1 choice with "correct" 
selected. Which function in admin I must use, to do that validation?

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



Re: User Registration -> Password not saving

2011-09-22 Thread Daniel Roseman


On Wednesday, 21 September 2011 23:42:02 UTC+1, Kurtis wrote:
>
> Hey, 
>
> I've created my own User Registration FormView. Everything seems to 
> work great except the password is always saved as "!". I can change 
> that with the "password changer" in the admin section of the site. I 
> am using an alternative authentication backend, so I'm not sure if 
> that was causing problems. I went ahead and included the default 
> authentication backend as well (at the front of the list) but that 
> didn't seem to change things. I've included my code at the bottom. Any 
> help would be greatly appreciated! Also, if there's anything wierd 
> about my code, let me know. I'm still learning. 
>
> 

 

> class SignUpForm(forms.Form): 
>
> email = forms.EmailField(required = True, label = u'Email 
> Address') 
> firstName = forms.CharField(required = True) 
> lastName = forms.CharField(required = True) 
> password = PasswordField() 
> password_confirm = forms.CharField(label = u'Password 
> Confirmation', 
> widget = forms.PasswordInput(render_value = 
> False), 
> required = True) 
>
> 


What is PasswordField?
-- 
DR. 

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



Re: changes to .py file is not reflected until server is restarted.

2011-09-22 Thread kenneth gonsalves
On Wed, 2011-09-21 at 19:37 +0100, Cal Leeming [Simplicity Media Ltd]
wrote:
> Oh jeez - modpython, I've nfi how to make that work with the same
> approach. Maybe check mod_python docs??

apachectl graceful - no other way.
-- 
regards
Kenneth Gonsalves

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