Aw: Re: any recipes for 'live' updating a site with model changes

2011-07-26 Thread Juergen Schackmann
I will publish a new app to maintain models dynamically at runtime on the 
weekend

-- 
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/-/eWnQvLa89CYJ.
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: Database doubt

2011-07-26 Thread Mike Dewhirst

As someone else said to another person today - use South

http://south.aeracode.org/docs/about.html

It will read your updated models and apply the changes to the database. 
It is brilliant.


Mike


On 27/07/2011 6:20am, Gmail - neonmark wrote:

On 7/26/2011 11:50 PM, vaibhav agarwal wrote:

Hey,

I am coding in django for the first time and I had this doubt about
database.At the start of coding , you are not sure of all the fields
in the models of your site. So you end up making a few fields and
proceed . But if at some other time , you might realise that you have
to add a new field . In such a case syncdb does not change the table
( maybe deleting or adding fields ) . What  should I be doing in such
a case ? 


--
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: ALL CAPS input and Sentence case

2011-07-26 Thread Mike Dewhirst

On 27/07/2011 1:48am, christian.posta wrote:

Forgive me if this might be more of a python-centric or text-handling
question more than Django, but it does come up within the context of
web development, processing user input, etc in all web frameworks
including django. I did a quick search on the forum and couldn't find
an answer. (I've also googled, but didn't turn up anything
useful). Maybe someone can direct me to the answer...

For user input, I would like to format what they enter into 'sentence
case'
Example, if they input ALL CAPS for a description, I want to lowercase
that, but according to sentence rules (first word in sentence upper
case, rest lowercase up to the period).

I was hoping something like this exists as a convenience function/
module, but if not i guess i'll have to write it myself.


It isn't easy for English and I don't know about other languages. Long 
ago I wrote such a thing for mailing addresses. If it is free text your 
users are writing you have to deal with all sorts of stuff. I only had 
to handle names like McTavish, O'Reilly and so on. Also I had to use an 
array of known upper-case acronyms such as USA, GPO etc.


On the other hand, if you write it in Python from a test-driven 
perspective it would become a very useful library.


I'd be super-keen to use it.

Mike




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: Built-in template tags and filters

2011-07-26 Thread Karen Tracey
On Sun, Jul 24, 2011 at 9:07 AM, Uffe  wrote:

> When attempting to use the template feature for *looping over a list of
> lists* (see manual extract below), I get:
>
> "TemplateSyntaxError: 'for' statements with five words should end in
> 'reversed': for x, y in points" (django_0_96)
>
> Trying to make a workaround, using the filter { value|first }, and {
> value|last }, 'first' works, but I get 'invalid filter' on 'last'. Has
> 'last' somehow been forgotten?
>
> Did I miss something, or am I riding a dead horse?
>

You are riding a dead horse, rather. List unpacking was added to the for tag
about 4 years ago (https://code.djangoproject.com/changeset/5443). The 0.96
release you are using is a bit older. The last filter, added in early 2008 (
https://code.djangoproject.com/changeset/6998), is even newer than for's
list unpacking feature.

Karen
-- 
http://tracey.org/kmt/

-- 
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.py: is it safe to store the request in an XXXAdmin object?

2011-07-26 Thread Fred Janon
Hi,

Is it safe to store the request in the OrderAdmin instance as in the code
below? Or are the OrderAdmin instances shared across requests?

class OrderAdmin(admin.ModelAdmin):
...
def get_form(self, request, *args, **kwargs):
# Stash the request so we can access the current user
in formfield_for_dbfield() later.
self.request = request # < Safe?
return super(OrderAdmin, self).get_form(request, *args, **kwargs)

Thanks

Fred

-- 
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: any recipes for 'live' updating a site with model changes

2011-07-26 Thread Shawn Milochik
Just use South. That's exactly what it was made for.

http://south.aeracode.org/

-- 
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: Different results for same queryset on devserver and testserver

2011-07-26 Thread innervision
By the way, I forgot to point out that this is actually a GeoQuerySet,
so that might explain the rarity of the issue.

Cheers,
David

On Jul 26, 2:16 pm, innervision  wrote:
> Hi,
>
> I'm experiencing the weirdest of errors with one of my tests. What
> happens is the following: I create a queryset by on a model that has
> (among other fields) an 'author' and a 'public' field. I want to limit
> an anonymous user to only view those instances marked as
> "public=True", so I do the usual:
>
> objects = MyModel.objects.filter(public=True)
>
> So far, so good. Then I try to slice that queryset depending on some
> pre-validated pagination parameters like:
>
> myslice = object[lower_bound:upper_bound]
>
> Now, this is where things get weird. That code seems to work perfectly
> well in the development server *and* when deployed to production
> (Nginx + uWSGI). I decided to write a test to make sure that users not
> providing credentials were only able to see exactly the same objects.
> The way I test that (there might be a more elegant way) is by loading
> the exact same dataset on the test method, and matching the results
> with what my view returns (JSON-encoded version of the same data).
> Problem is, when running the unit tests the queryset breaks. If I
> check how many elements there are by using .count() it returns the
> expected number, but when I try to slice it, it looks like it's empty
> (in other words "assert False, queryset" will display "AssertionError:
> []".)
>
> Luckily this just happens inside the test case, but it's kind of
> annoying as it means I have a test that always fails. Any ideas what
> might be happening?
>
> Thanks in advance,
> David

-- 
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: Re: Fieldsets in Admin Inline

2011-07-26 Thread Micky Hulse
Awesome! Glad that helped and thanks for the warning. One of these
days I will need this functionality myself. :)

Have a great day!

Cheers,
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: Import error

2011-07-26 Thread bruno desthuilliers
On 26 juil, 18:59, shakthi  wrote:
> i am implementing the django admin interface in my site.
> after changing the settings and the urls file, i am getting an import
> error on the web browser.
> the error was "import error"
> "No module named urls"
>
> also when i check for that file by giving the command 'pydoc
> django.contrib.admin.urls' in terminal, i am getting import
> error."settings cannot be imported because environment variable
> DJANGO_SETTINGS_MODULE is undefined
>
> please sort it out

No problem. My daily fees are about €500, please contact me in private
so we can agree on the legal details before I start working on your
"problem".

-- 
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.



any recipes for 'live' updating a site with model changes

2011-07-26 Thread Gelonida N
Hi,

Let's imagine I have a web server running with a Django application.

Now I want to install an update (with a modified model)

Is there any recommended way to upgrade such a server?
Are there any tools helping with such upgrades or with creating upgrade
scripts?

If I had to do it 'manually' this is roughly what I'd do:
- reconfigure the web server to redirect to an 'under maintenance' site
- Before unistalling any new code:
dump all tables
- install the new version
- start an upgrade function, which deletes all tables and repopulates
them from the dumps with some potential conversions.


Thanks in advance for suggestions or examples of projects which handle
updates more or less on the fly.

-- 
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: Has anyone used the "djangoles-tutorial.pdf" tutorial?

2011-07-26 Thread William C Grisaitis
Dear James, Gath, and others,

Thanks for your help!

I think I have the problem mostly solved by now. Basically, I didn't know
how to add a view to the urls.py file when I made a new view in an app. I
think I have it figured out now. :) Originally I was doing something like
this in urls.py:

urlpatterns = patterns( 'members.views',
   ( r'', 'view1' ),
   ( r'', 'view2' ),
   )

and only the first view was executing. Eventually I figured out that I had
to make a new url pattern to make the second view execute, like this:

urlpatterns = patterns( 'members.views',
   ( r'', 'view1' ),
   ( r'new url pattern', 'view2' ),
   )

That said, is it possible to have multiple views assigned to one url
pattern? It looks like this has already been asked on this listserv, and
indeed elsewhere on the web, and the general consensus, I gather, is no:
only one view per url pattern.

Is there any fancy work around I'm missing? :)

The views I was dealing with were pretty simple - just
HttpResponse('Hey!')type stuff. Actually, I'll just paste them here.
If you're looking at the
tutorial, this in the views.py file of the `members` app:

def myFirstView( request ):
return HttpResponse( "Hey, world!" )

def membersList( request ):
result = ""
for m in Member.objects.all():
result += "%s --- study: %s" % ( m, m.study )
return HttpResponse( result )

When I was working through this for the first few times, I was hoping to see
"Hey, world!" followed by the list of members, all on one page. Instead, all
that showed up was "Hey, world!", and no members. If I changed the order in
which I added the views in the patterns() call, then I saw the list of
members, but no "Hey..."

So, in the context of this tutorial, is there a way to make both of those
messages appear when I go to the "http://127.0.0.1:8000/members/; address?

What I eventually did was I changed urlpatterns to be like this:

urlpatterns = patterns( 'members.views',
   ( r'^$', 'myFirstView' ),
   ( r'^list$', 'membersList' ),
   )

which works just fine. But, what I'd like to see is both HttpResponse()
messages on the screen when I navigate to the '^$' url pattern.

I tried the following work-arounds or fixes:

1) make a single view that combines the two. For example, what if I have the
following:

def view1( response ):
return HttpResponse( 'Django is fun!' )

def view2( response ):
return HttpResponse( 'I like turtles.' )

and I want my web site to print both of those messages on the screen. Pretty
basic… nothing fancy. I tried combining the functions, like this:

def allViews( request ):
return view1( request ) + view2( request )

which was an abysmal failure, probably due to how the return values for
HttpResponse() work. If I learned more about that, I could probably combine
the messages in an intelligent manner and get what I want. Is this worth
playing around with, or is there a simpler way to just have both messages
print?

2) Try messing around with the patterns() input. What about this in urls.py:

urlpatterns = patterns( 'members.views',
   ( r'', 'view1', 'view2' ),
   )

Whoa, that definitely doesn't work! Haha.. Again, bear with me… I've just
started learning how all these functions work.

Anyway, here's the source code for the tutorial project, excluding any
default stuff that Eclipse makes when you make a django project. Basically
the tutorial tells you to make a Django project in Eclipse named
`djangolesson`. Inside it you make an app named `members` with some models
and views, a database to store instances of those models, and then some more
views that do stuff with the database. Along the way it shows you how to
edit other files like settings.py, urls.py, etc to make it all work.

Files inside `djangolesson`:

 settings.py: ==

change INSTALLED_APPS to also include
'djangolesson.members',
and
'django.contrib.admin',
like this:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'djangolesson.members', # add this one
'django.contrib.admin', # and this
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
 )

 urls.py ==

from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

# Notes: this code makes sure that any url starting with 'appName' will be
processed in the urls.py files of the app named 'appName'. These urls.py
files don't exist automatically;  we have to create one 

Re: ALL CAPS input and Sentence case

2011-07-26 Thread bruno desthuilliers
On 26 juil, 18:38, Kirill Spitsin  wrote:
>
> You can try this code, seems to do what you 
> want:http://mail.python.org/pipermail/tutor/2004-September/031859.html
>

Looks a bit complicated (and with some useless code here and there) to
me, but that's a problem I never tried to solve. OTHO, doing it right
would require way too much natural language processing, with lot of
language specific rules...

-- 
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.



Aw: Re: Fieldsets in Admin Inline

2011-07-26 Thread Juergen Schackmann
thanks a lot for googling this link (somehow google decided to hide it from 
me :-) )
it works for me!

just one word warning with the link: the code as described does not work for 
me, since the parent Admin refers to field in its fieldsets attribute that 
refer to the child and this raises the error: 

ImproperlyConfigured at ...

MetaModelAdmin.fieldsets[2][1]['fields']' refers to field 'type' that is 
missing from the form

after removing the specific field and only leave it in the fieldsets of the 
Inline, everything is working fine

-- 
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/-/v7lPtjDhtuUJ.
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.



Different results for same queryset on devserver and testserver

2011-07-26 Thread innervision
Hi,

I'm experiencing the weirdest of errors with one of my tests. What
happens is the following: I create a queryset by on a model that has
(among other fields) an 'author' and a 'public' field. I want to limit
an anonymous user to only view those instances marked as
"public=True", so I do the usual:

objects = MyModel.objects.filter(public=True)

So far, so good. Then I try to slice that queryset depending on some
pre-validated pagination parameters like:

myslice = object[lower_bound:upper_bound]

Now, this is where things get weird. That code seems to work perfectly
well in the development server *and* when deployed to production
(Nginx + uWSGI). I decided to write a test to make sure that users not
providing credentials were only able to see exactly the same objects.
The way I test that (there might be a more elegant way) is by loading
the exact same dataset on the test method, and matching the results
with what my view returns (JSON-encoded version of the same data).
Problem is, when running the unit tests the queryset breaks. If I
check how many elements there are by using .count() it returns the
expected number, but when I try to slice it, it looks like it's empty
(in other words "assert False, queryset" will display "AssertionError:
[]".)

Luckily this just happens inside the test case, but it's kind of
annoying as it means I have a test that always fails. Any ideas what
might be happening?

Thanks in advance,
David

-- 
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: Database doubt

2011-07-26 Thread Gmail - neonmark
its also explained quite well how to do this manually - simply follow 
the tutorial on the site.

https://docs.djangoproject.com/en/1.3/


On 7/26/2011 11:50 PM, vaibhav agarwal wrote:

Hey,

I am coding in django for the first time and I had this doubt about
database.At the start of coding , you are not sure of all the fields
in the models of your site. So you end up making a few fields and
proceed . But if at some other time , you might realise that you have
to add a new field . In such a case syncdb does not change the table
( maybe deleting or adding fields ) . What  should I be doing in such
a case ?

Thanks for the help in advance.

Cheers



--
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: Geographic Data on Django

2011-07-26 Thread Gmail - neonmark
Check out this site - with source - uses postgis and does something 
similar, perhaps, to what you want.

https://github.com/openplans/fixcity

On 7/27/2011 8:00 AM, Dan H wrote:

Hey I am building a website similar to Yelp. I want users to be able
to submit data on their interface with a particular establishment. I
want a user to be able to find this establishment either by searching
the database or by gps, using google maps api. How would I store the
geographic data in the django databases? I am a complete new guy to
django.



--
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: Accessing "request" from within an authentication backend

2011-07-26 Thread Scott Gould
I'd raise a custom exception (e.g. "PasswordExpiredError") and handle
the message creation in the view.

On Jul 26, 3:59 pm, Steven Smith  wrote:
> Is there a way to access the HttpResponse, or issue a redirect from
> within a custom authentication backend? I have Django hooked up to our
> Active Directory server, and it works perfectly except when the user's
> password expires or they have "User must change password at next
> login" set on their account. In these circumstances, I'd like to be
> able to spit out a message (using contrib.messages) stating that they
> are required to change their password, and then (ideally) issue an
> HttpResponseRedirect over to our "change password" website, which is,
> coincidentally, on the same Django system, so the message would carry
> over and stuff... but I need to be able to set it in the first place.

-- 
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: Geographic Data on Django

2011-07-26 Thread Andre Terra
http://geodjango.org/

GL!

Cheers,
AT

On Tue, Jul 26, 2011 at 5:00 PM, Dan H  wrote:

> Hey I am building a website similar to Yelp. I want users to be able
> to submit data on their interface with a particular establishment. I
> want a user to be able to find this establishment either by searching
> the database or by gps, using google maps api. How would I store the
> geographic data in the django databases? I am a complete new guy to
> django.
>
> --
> 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: ALL CAPS input and Sentence case

2011-07-26 Thread christian.posta
Awesome, I'll take a look! Thanks!

On Jul 26, 9:38 am, Kirill Spitsin  wrote:
> On Tue, Jul 26, 2011 at 07:19:46PM +0300, Kirill Spitsin wrote:
> > On Tue, Jul 26, 2011 at 08:48:24AM -0700, christian.posta wrote:
> > > For user input, I would like to format what they enter into 'sentence
> > > case'
> > > Example, if they input ALL CAPS for a description, I want to lowercase
> > > that, but according to sentence rules (first word in sentence upper
> > > case, rest lowercase up to the period).
>
> > > I was hoping something like this exists as a convenience function/
> > > module, but if not i guess i'll have to write it myself.
>
> > >>> 'ALL CAPS. aNd MixED.'.title()
> > 'All Caps. And Mixed.'
>
> Or, sorry, I've read your question carelessly.
>
> You can try this code, seems to do what you 
> want:http://mail.python.org/pipermail/tutor/2004-September/031859.html
>
> --
> Kirill Spitsin

-- 
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, Apache, MySQL on Windows in Production

2011-07-26 Thread Dimitry Zolotaryov
Thanks to everyone for your time.

Michael, I have found a similar GIL-related issue on ServerFault:
http://groups.google.com/group/django-users/browse_thread/thread/4c42b458fd5bfba9

Are there ways to code around this limitation? What versions were you
running when you encountered these issues?

Thanks, again.

Dimitry

On 26 juil, 15:27, Michael Manfre  wrote:
> I have a decent amount of experience with running apache, mod_wsgi and
> django on windows (w/ MS SQL). Apache's process module on windows
> (mpm_winnt) may result in you having to configure around some serious
> GIL related performance issues. You might not hit the problems if the
> site is low traffic. You can work around it with a load balancer
> (either apache, haproxy, or other of your choice) sitting in front of
> several apache instances on the same machine with ideally each having
> their processor affinity set to a different, single processor. You'll
> need to keep the threads per child low to avoid memory bloat. This set
> up basically fakes the other process modules available on linux.
>
> I also did a bit of testing with nginx on windows. It's very resource
> efficient and fast, but it didn't run well as a service on windows. It
> orphaned processes when restarting the service.
>
> Regards,
> Michael Manfre
>
> On Jul 26, 2:10 pm, Andre Terra  wrote:
>
>
>
>
>
>
>
> > I recently compiled nginx with an additional module on windows and so far,
> > so good. I'm probably skipping Apache altogether for this small website.
>
> > As far as PostgreSQL goes, from what I've seen, it works flawlessly on
> > Windows. Never heard of anyone complaining about that.
>
> > Cheers,
> > AT
>
> > On Tue, Jul 26, 2011 at 3:03 PM, CrabbyPete  wrote:
> > > I've run django on Windows Server with apache and it was easy to
> > > deploy.  Forget IIS. I've deployed Nginx and uWSGI on linux and that
> > > was even easier.
> > > I've never done Nginx on windows, but I don't think it would be a big
> > > deal.
>
> > > On Jul 26, 1:25 pm, Dimitry Zolotaryov  wrote:
> > > > So if I run into performance issues, I can always pipe from Apache to
> > > > something like gunicorn and keep Apache serving static media?
>
> > > > Dimitry
>
> > > > On 26 juil, 13:03, Javier Guerra Giraldez  wrote:
>
> > > > > On Tue, Jul 26, 2011 at 11:33 AM, Dimitry Zolotaryov 
> > > > > 
> > > wrote:
> > > > > > Knowing this, any advice on the original question would be greatly
> > > > > > appreciated.
>
> > > > > I haven't done any deployment on windows; but i do know some helpful
> > > facts:
>
> > > > > - microsoft invests a lot of money in making sure that high-profile
> > > > > OSS projects do run and run well on windows.  That definitely includes
> > > > > Apache, Python, and MySQL at least.   don't know if PostgreSQL enjoys
> > > > > this treatment (might erode into MS-SQL server mindshare?)
>
> > > > > - nginx and mod_wsgi can be compiled, and kinda run; but with severe
> > > > > limitations.  mod_wsgi in particular can't run in daemon mode.
>
> > > > > - any pure-Python setting should run without surprises, that lets you
> > > > > choose either gunicorn or flup (for FastCGI) behind Apache.  contrary
> > > > > to some comments, a well-supervised flup setup can perform just as
> > > > > good as the cool guys; but if you're not familiar with it gunicorn
> > > > > might be easier.  again, it's more a question of familiarity than of
> > > > > performance.
>
> > > > > good luck!
>
> > > > > --
> > > > > Javier
>
> > > --
> > > 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.



Geographic Data on Django

2011-07-26 Thread Dan H
Hey I am building a website similar to Yelp. I want users to be able
to submit data on their interface with a particular establishment. I
want a user to be able to find this establishment either by searching
the database or by gps, using google maps api. How would I store the
geographic data in the django databases? I am a complete new guy to
django.

-- 
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.



Accessing "request" from within an authentication backend

2011-07-26 Thread Steven Smith
Is there a way to access the HttpResponse, or issue a redirect from
within a custom authentication backend? I have Django hooked up to our
Active Directory server, and it works perfectly except when the user's
password expires or they have "User must change password at next
login" set on their account. In these circumstances, I'd like to be
able to spit out a message (using contrib.messages) stating that they
are required to change their password, and then (ideally) issue an
HttpResponseRedirect over to our "change password" website, which is,
coincidentally, on the same Django system, so the message would carry
over and stuff... but I need to be able to set it in the first place.

-- 
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, Apache, MySQL on Windows in Production

2011-07-26 Thread Michael Manfre
I have a decent amount of experience with running apache, mod_wsgi and
django on windows (w/ MS SQL). Apache's process module on windows
(mpm_winnt) may result in you having to configure around some serious
GIL related performance issues. You might not hit the problems if the
site is low traffic. You can work around it with a load balancer
(either apache, haproxy, or other of your choice) sitting in front of
several apache instances on the same machine with ideally each having
their processor affinity set to a different, single processor. You'll
need to keep the threads per child low to avoid memory bloat. This set
up basically fakes the other process modules available on linux.

I also did a bit of testing with nginx on windows. It's very resource
efficient and fast, but it didn't run well as a service on windows. It
orphaned processes when restarting the service.

Regards,
Michael Manfre

On Jul 26, 2:10 pm, Andre Terra  wrote:
> I recently compiled nginx with an additional module on windows and so far,
> so good. I'm probably skipping Apache altogether for this small website.
>
> As far as PostgreSQL goes, from what I've seen, it works flawlessly on
> Windows. Never heard of anyone complaining about that.
>
> Cheers,
> AT
>
>
>
>
>
>
>
> On Tue, Jul 26, 2011 at 3:03 PM, CrabbyPete  wrote:
> > I've run django on Windows Server with apache and it was easy to
> > deploy.  Forget IIS. I've deployed Nginx and uWSGI on linux and that
> > was even easier.
> > I've never done Nginx on windows, but I don't think it would be a big
> > deal.
>
> > On Jul 26, 1:25 pm, Dimitry Zolotaryov  wrote:
> > > So if I run into performance issues, I can always pipe from Apache to
> > > something like gunicorn and keep Apache serving static media?
>
> > > Dimitry
>
> > > On 26 juil, 13:03, Javier Guerra Giraldez  wrote:
>
> > > > On Tue, Jul 26, 2011 at 11:33 AM, Dimitry Zolotaryov 
> > wrote:
> > > > > Knowing this, any advice on the original question would be greatly
> > > > > appreciated.
>
> > > > I haven't done any deployment on windows; but i do know some helpful
> > facts:
>
> > > > - microsoft invests a lot of money in making sure that high-profile
> > > > OSS projects do run and run well on windows.  That definitely includes
> > > > Apache, Python, and MySQL at least.   don't know if PostgreSQL enjoys
> > > > this treatment (might erode into MS-SQL server mindshare?)
>
> > > > - nginx and mod_wsgi can be compiled, and kinda run; but with severe
> > > > limitations.  mod_wsgi in particular can't run in daemon mode.
>
> > > > - any pure-Python setting should run without surprises, that lets you
> > > > choose either gunicorn or flup (for FastCGI) behind Apache.  contrary
> > > > to some comments, a well-supervised flup setup can perform just as
> > > > good as the cool guys; but if you're not familiar with it gunicorn
> > > > might be easier.  again, it's more a question of familiarity than of
> > > > performance.
>
> > > > good luck!
>
> > > > --
> > > > Javier
>
> > --
> > 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, Apache, MySQL on Windows in Production

2011-07-26 Thread Andre Terra
I recently compiled nginx with an additional module on windows and so far,
so good. I'm probably skipping Apache altogether for this small website.

As far as PostgreSQL goes, from what I've seen, it works flawlessly on
Windows. Never heard of anyone complaining about that.


Cheers,
AT

On Tue, Jul 26, 2011 at 3:03 PM, CrabbyPete  wrote:

> I've run django on Windows Server with apache and it was easy to
> deploy.  Forget IIS. I've deployed Nginx and uWSGI on linux and that
> was even easier.
> I've never done Nginx on windows, but I don't think it would be a big
> deal.
>
> On Jul 26, 1:25 pm, Dimitry Zolotaryov  wrote:
> > So if I run into performance issues, I can always pipe from Apache to
> > something like gunicorn and keep Apache serving static media?
> >
> > Dimitry
> >
> > On 26 juil, 13:03, Javier Guerra Giraldez  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > On Tue, Jul 26, 2011 at 11:33 AM, Dimitry Zolotaryov 
> wrote:
> > > > Knowing this, any advice on the original question would be greatly
> > > > appreciated.
> >
> > > I haven't done any deployment on windows; but i do know some helpful
> facts:
> >
> > > - microsoft invests a lot of money in making sure that high-profile
> > > OSS projects do run and run well on windows.  That definitely includes
> > > Apache, Python, and MySQL at least.   don't know if PostgreSQL enjoys
> > > this treatment (might erode into MS-SQL server mindshare?)
> >
> > > - nginx and mod_wsgi can be compiled, and kinda run; but with severe
> > > limitations.  mod_wsgi in particular can't run in daemon mode.
> >
> > > - any pure-Python setting should run without surprises, that lets you
> > > choose either gunicorn or flup (for FastCGI) behind Apache.  contrary
> > > to some comments, a well-supervised flup setup can perform just as
> > > good as the cool guys; but if you're not familiar with it gunicorn
> > > might be easier.  again, it's more a question of familiarity than of
> > > performance.
> >
> > > good luck!
> >
> > > --
> > > Javier
>
> --
> 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, Apache, MySQL on Windows in Production

2011-07-26 Thread CrabbyPete
PS, I used mod_wsgi and make sure you have the latest pywin32

On Jul 26, 2:03 pm, CrabbyPete  wrote:
> I've run django on Windows Server with apache and it was easy to
> deploy.  Forget IIS. I've deployed Nginx and uWSGI on linux and that
> was even easier.
> I've never done Nginx on windows, but I don't think it would be a big
> deal.
>
> On Jul 26, 1:25 pm, Dimitry Zolotaryov  wrote:
>
>
>
>
>
>
>
> > So if I run into performance issues, I can always pipe from Apache to
> > something like gunicorn and keep Apache serving static media?
>
> > Dimitry
>
> > On 26 juil, 13:03, Javier Guerra Giraldez  wrote:
>
> > > On Tue, Jul 26, 2011 at 11:33 AM, Dimitry Zolotaryov  
> > > wrote:
> > > > Knowing this, any advice on the original question would be greatly
> > > > appreciated.
>
> > > I haven't done any deployment on windows; but i do know some helpful 
> > > facts:
>
> > > - microsoft invests a lot of money in making sure that high-profile
> > > OSS projects do run and run well on windows.  That definitely includes
> > > Apache, Python, and MySQL at least.   don't know if PostgreSQL enjoys
> > > this treatment (might erode into MS-SQL server mindshare?)
>
> > > - nginx and mod_wsgi can be compiled, and kinda run; but with severe
> > > limitations.  mod_wsgi in particular can't run in daemon mode.
>
> > > - any pure-Python setting should run without surprises, that lets you
> > > choose either gunicorn or flup (for FastCGI) behind Apache.  contrary
> > > to some comments, a well-supervised flup setup can perform just as
> > > good as the cool guys; but if you're not familiar with it gunicorn
> > > might be easier.  again, it's more a question of familiarity than of
> > > performance.
>
> > > good luck!
>
> > > --
> > > Javier

-- 
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, Apache, MySQL on Windows in Production

2011-07-26 Thread CrabbyPete
I've run django on Windows Server with apache and it was easy to
deploy.  Forget IIS. I've deployed Nginx and uWSGI on linux and that
was even easier.
I've never done Nginx on windows, but I don't think it would be a big
deal.

On Jul 26, 1:25 pm, Dimitry Zolotaryov  wrote:
> So if I run into performance issues, I can always pipe from Apache to
> something like gunicorn and keep Apache serving static media?
>
> Dimitry
>
> On 26 juil, 13:03, Javier Guerra Giraldez  wrote:
>
>
>
>
>
>
>
> > On Tue, Jul 26, 2011 at 11:33 AM, Dimitry Zolotaryov  
> > wrote:
> > > Knowing this, any advice on the original question would be greatly
> > > appreciated.
>
> > I haven't done any deployment on windows; but i do know some helpful facts:
>
> > - microsoft invests a lot of money in making sure that high-profile
> > OSS projects do run and run well on windows.  That definitely includes
> > Apache, Python, and MySQL at least.   don't know if PostgreSQL enjoys
> > this treatment (might erode into MS-SQL server mindshare?)
>
> > - nginx and mod_wsgi can be compiled, and kinda run; but with severe
> > limitations.  mod_wsgi in particular can't run in daemon mode.
>
> > - any pure-Python setting should run without surprises, that lets you
> > choose either gunicorn or flup (for FastCGI) behind Apache.  contrary
> > to some comments, a well-supervised flup setup can perform just as
> > good as the cool guys; but if you're not familiar with it gunicorn
> > might be easier.  again, it's more a question of familiarity than of
> > performance.
>
> > good luck!
>
> > --
> > Javier

-- 
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, Apache, MySQL on Windows in Production

2011-07-26 Thread Dimitry Zolotaryov
So if I run into performance issues, I can always pipe from Apache to
something like gunicorn and keep Apache serving static media?

Dimitry

On 26 juil, 13:03, Javier Guerra Giraldez  wrote:
> On Tue, Jul 26, 2011 at 11:33 AM, Dimitry Zolotaryov  wrote:
> > Knowing this, any advice on the original question would be greatly
> > appreciated.
>
> I haven't done any deployment on windows; but i do know some helpful facts:
>
> - microsoft invests a lot of money in making sure that high-profile
> OSS projects do run and run well on windows.  That definitely includes
> Apache, Python, and MySQL at least.   don't know if PostgreSQL enjoys
> this treatment (might erode into MS-SQL server mindshare?)
>
> - nginx and mod_wsgi can be compiled, and kinda run; but with severe
> limitations.  mod_wsgi in particular can't run in daemon mode.
>
> - any pure-Python setting should run without surprises, that lets you
> choose either gunicorn or flup (for FastCGI) behind Apache.  contrary
> to some comments, a well-supervised flup setup can perform just as
> good as the cool guys; but if you're not familiar with it gunicorn
> might be easier.  again, it's more a question of familiarity than of
> performance.
>
> good luck!
>
> --
> Javier

-- 
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.



making a search page using generic class views

2011-07-26 Thread akonsu
hello,

I am trying to migrate my function based views to class based ones. I
have a search page with a form (which is represented by MySearchForm
class). The form's action URL is set to the current page (). When the form is submitted the search
results are shown in the page below the form. in other words I do not
have a "success URL" used by several ready-made views in
django.views.generic namespace, so I think I cannot use them. Does
this mean I need to write my view from scratch? so far I think that I
need to have:

class MySearchView(ListView, ProcessFormView) :
   ...

Does this look right? If so, where does MySearchForm come in to play?
how do I instantiate it and check for validity?

I am new to this, so I am lost because the documentation is very raw.
Basically my question is how do I implement such a view? would someone
please help?

thanks
konstantin

-- 
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, Apache, MySQL on Windows in Production

2011-07-26 Thread Javier Guerra Giraldez
On Tue, Jul 26, 2011 at 11:33 AM, Dimitry Zolotaryov  wrote:
> Knowing this, any advice on the original question would be greatly
> appreciated.

I haven't done any deployment on windows; but i do know some helpful facts:

- microsoft invests a lot of money in making sure that high-profile
OSS projects do run and run well on windows.  That definitely includes
Apache, Python, and MySQL at least.   don't know if PostgreSQL enjoys
this treatment (might erode into MS-SQL server mindshare?)

- nginx and mod_wsgi can be compiled, and kinda run; but with severe
limitations.  mod_wsgi in particular can't run in daemon mode.

- any pure-Python setting should run without surprises, that lets you
choose either gunicorn or flup (for FastCGI) behind Apache.  contrary
to some comments, a well-supervised flup setup can perform just as
good as the cool guys; but if you're not familiar with it gunicorn
might be easier.  again, it's more a question of familiarity than of
performance.


good luck!

-- 
Javier

-- 
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.



Import error

2011-07-26 Thread shakthi
i am implementing the django admin interface in my site.
after changing the settings and the urls file, i am getting an import
error on the web browser.
the error was "import error"
"No module named urls"

also when i check for that file by giving the command 'pydoc
django.contrib.admin.urls' in terminal, i am getting import
error."settings cannot be imported because environment variable
DJANGO_SETTINGS_MODULE is undefined

please sort it out
thank you

-- 
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: ALL CAPS input and Sentence case

2011-07-26 Thread Kirill Spitsin
On Tue, Jul 26, 2011 at 07:19:46PM +0300, Kirill Spitsin wrote:
> On Tue, Jul 26, 2011 at 08:48:24AM -0700, christian.posta wrote:
> > For user input, I would like to format what they enter into 'sentence
> > case'
> > Example, if they input ALL CAPS for a description, I want to lowercase
> > that, but according to sentence rules (first word in sentence upper
> > case, rest lowercase up to the period).
> > 
> > I was hoping something like this exists as a convenience function/
> > module, but if not i guess i'll have to write it myself.
> 
> >>> 'ALL CAPS. aNd MixED.'.title()
> 'All Caps. And Mixed.'

Or, sorry, I've read your question carelessly.

You can try this code, seems to do what you want:
http://mail.python.org/pipermail/tutor/2004-September/031859.html

-- 
Kirill Spitsin

-- 
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, Apache, MySQL on Windows in Production

2011-07-26 Thread Dimitry Zolotaryov
Javier,

You're correct in assuming that these are the tools I'm most
comfortable with.

Knowing this, any advice on the original question would be greatly
appreciated.

Thanks.

Dimitry

On Jul 26, 11:03 am, Javier Guerra Giraldez 
wrote:
> On Tue, Jul 26, 2011 at 9:23 AM, Andre Terra  wrote:
> > You can take a look at using something like nginx for serving small static
> > files, which can otherwise keep Apache busy and therefore delay its response
> > for more important tasks.
>
> > At the risk of flaming, I should note that I have never heard of anything
> > that MySQL does better than PostgreSQL. Most of the users I've encountered
> > use it because it's the devil they know, but eventually it has quite a few
> > shortcomings that can be quite annoying in some cases.
>
> while it's true that the most used tools aren't always the best,
> there's also the issue of not introducing too much unknown variables,
> especially when you're not really experienced on all of them.
>
> In this case, Dimitry needs to use a less-supported OS; i'd advise to
> stay with what's known to work well.
>
> IOW: how's nginx and PostgreSQL support on windows?
>
> --
> Javier

-- 
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.



ALL CAPS input and Sentence case

2011-07-26 Thread christian.posta
Forgive me if this might be more of a python-centric or text-handling
question more than Django, but it does come up within the context of
web development, processing user input, etc in all web frameworks
including django. I did a quick search on the forum and couldn't find
an answer. (I've also googled, but didn't turn up anything
useful). Maybe someone can direct me to the answer...

For user input, I would like to format what they enter into 'sentence
case'
Example, if they input ALL CAPS for a description, I want to lowercase
that, but according to sentence rules (first word in sentence upper
case, rest lowercase up to the period).

I was hoping something like this exists as a convenience function/
module, but if not i guess i'll have to write it myself.

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: ALL CAPS input and Sentence case

2011-07-26 Thread Kirill Spitsin
On Tue, Jul 26, 2011 at 08:48:24AM -0700, christian.posta wrote:
> For user input, I would like to format what they enter into 'sentence
> case'
> Example, if they input ALL CAPS for a description, I want to lowercase
> that, but according to sentence rules (first word in sentence upper
> case, rest lowercase up to the period).
> 
> I was hoping something like this exists as a convenience function/
> module, but if not i guess i'll have to write it myself.

>>> 'ALL CAPS. aNd MixED.'.title()
'All Caps. And Mixed.'

-- 
Kirill Spitsin

-- 
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, Pinax, Dreamhost Project

2011-07-26 Thread Jeremy
Hello all, I'm not sure if this is the right place to post this, but
was sent this direction, so if not please let me know.  I'm incredibly
new to Django, and I'm trying to set up a personal site with a Pinax
install.  I chose Pinax because most of what the site needs to do,
Pinax is capable of "out of the box."  I'm sure there are similar
options and if so please let me know.  The point is I'm running into
errors just getting the site off the ground, but I need to have it up
and running really soon.  I am totally willing to pay someone to give
me a hand with this (keep in mind my funds are a little limited) via
Pay Pal.  Let me know if anyone can help.  Again, let me know if this
post isn't appropriate and I'll try and find a better place for it.

Feel free to contact me at jeremycran...@gmail.com with your rates.
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: Django, Apache, MySQL on Windows in Production

2011-07-26 Thread Javier Guerra Giraldez
On Tue, Jul 26, 2011 at 9:23 AM, Andre Terra  wrote:
> You can take a look at using something like nginx for serving small static
> files, which can otherwise keep Apache busy and therefore delay its response
> for more important tasks.
>
> At the risk of flaming, I should note that I have never heard of anything
> that MySQL does better than PostgreSQL. Most of the users I've encountered
> use it because it's the devil they know, but eventually it has quite a few
> shortcomings that can be quite annoying in some cases.

while it's true that the most used tools aren't always the best,
there's also the issue of not introducing too much unknown variables,
especially when you're not really experienced on all of them.

In this case, Dimitry needs to use a less-supported OS; i'd advise to
stay with what's known to work well.

IOW: how's nginx and PostgreSQL support on windows?

-- 
Javier

-- 
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: Optimization of a Large QuerySet iteration

2011-07-26 Thread nixlists
On Tue, Jul 26, 2011 at 7:42 AM, Roman Klesel
 wrote:
...

> The main question you may ask yourself may be whether or not you
> really want to have django do the whole calculation thing. Many
> database engines have very powerful aggregation capabilities, support
> for stored procedures, functions etc.
> Some of the aggregation features are available through the django orm.

Thanks,

Is it a best practice to take a bunch of code out to the stored
procedures as much as possible, or the opposite is true with Django?

-- 
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: Optimization of a Large QuerySet iteration

2011-07-26 Thread nixlists
On Tue, Jul 26, 2011 at 9:52 AM, Tom Evans  wrote:
>  p_dict = dict(contract_products.values_list('product', 'wac__wac'))
>
> This should cut down the number of queries in the view significantly.

Thanks! This is much better than what I had.

-- 
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, Apache, MySQL on Windows in Production

2011-07-26 Thread Andre Terra
Hello, Dimitry

You can take a look at using something like nginx for serving small static
files, which can otherwise keep Apache busy and therefore delay its response
for more important tasks.

At the risk of flaming, I should note that I have never heard of anything
that MySQL does better than PostgreSQL. Most of the users I've encountered
use it because it's the devil they know, but eventually it has quite a few
shortcomings that can be quite annoying in some cases.


Cheers,
AT

On Tue, Jul 26, 2011 at 10:53 AM, Dimitry Zolotaryov wrote:

> Hi all,
>
> I was wandering if you could tell me what to look out for when
> installing Django with Apache on a Windows Server 2008 machine. Is
> there anything I should be aware of in terms of installation problems,
> performance issues or compatibility with some general purpose
> libraries?
>
> Thanks
>
> Dimitry
>
> PS Win 2k8 is a requirement; I have no choice in the matter. But
> choosing Apache over IIS is an option.
>
> --
> 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: USE_I18N vs. USE_L10N

2011-07-26 Thread Tom Evans
On Tue, Jul 26, 2011 at 1:46 PM, Andre Terra  wrote:
> On Tue, Jul 26, 2011 at 5:17 AM, Lucy Brennan 
> wrote:
>>
>> (...)
>>
>> For both the USE_L10N and USE_I18N their effect is not obvious from
>> their naming. I suggest, that the description of these parameters in
>> https://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs are
>> made more precise.
>>
>> From what I understand, they should have had names like
>> USE_TRANSLATION and USE_LOCALIZED_FORMATTING.
>
> +1 on that. Actually, I'd +over 9000 if I had the power.
>
>
> Cheers,
> AT
>

I strongly disagree, i18n and l10n have explicit and well known
technical meanings, dating from the late 80s. It is right and proper
to use those names in django, as they are used in every other project
under the sun.

Cheers

Tom

-- 
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.



How do I change my user password on Django's bug tracker?

2011-07-26 Thread cool-RR
Hello,

How do I change my user password on Django's bug tracker?


Thanks,
Ram.

-- 
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/-/Z1HJTz2KIkEJ.
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 and (d)ajax: forms, checkboxes, hrefs... a bit of everything (howto?)

2011-07-26 Thread Tom Evans
On Tue, Jul 26, 2011 at 2:53 PM, samuele.mattiuzzo  wrote:
> Sorry for the title, but i'm trying as hard as i can to learn (d)ajax
> and i have few problems.
>
> I'm trying to deploy something like this:
> http://case.trovit.it/index.php/cod.search_homes/type.1/what_d.New
> York/
>
> on the left side, there's a bunch of link (facets). i need to have
> something similar with checkboxes (whose labels are also links, for
> search engines crawling). i want django to post data on user click (or
> checkbox select) and refresh the results without reloading the page
> (so that's why ajax)
>
> can anybody help me getting started? i have most of the ajax basis
> covered, i'm developing django since 2 years (more or less)... i'm
> saying this so maybe we can avoid answers like "this is a beginner
> tutorial for html..." i need pretty advanced guides and advices or
> examples...
>
> Yeah! Thanks everybody for the answers!
>

1) Open your favourite text editor
2) Start typing

You seem to understand what you want to do, you say you've developed
in Django for two years, so what is stopping you? Get to it, show us
the problems/results.

Use whatever JS framework you feel comfortable with to handle events
(clicks etc) on the UI widgets, create AJAX requests to funnel the
information into Django, use Django to formulate HTML snippets which
you then insert into the page using your JS framework.

Cheers

Tom

-- 
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, Apache, MySQL on Windows in Production

2011-07-26 Thread Dimitry Zolotaryov
Hi all,

I was wandering if you could tell me what to look out for when
installing Django with Apache on a Windows Server 2008 machine. Is
there anything I should be aware of in terms of installation problems,
performance issues or compatibility with some general purpose
libraries?

Thanks

Dimitry

PS Win 2k8 is a requirement; I have no choice in the matter. But
choosing Apache over IIS is an option.

-- 
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 and (d)ajax: forms, checkboxes, hrefs... a bit of everything (howto?)

2011-07-26 Thread samuele.mattiuzzo
Sorry for the title, but i'm trying as hard as i can to learn (d)ajax
and i have few problems.

I'm trying to deploy something like this:
http://case.trovit.it/index.php/cod.search_homes/type.1/what_d.New
York/

on the left side, there's a bunch of link (facets). i need to have
something similar with checkboxes (whose labels are also links, for
search engines crawling). i want django to post data on user click (or
checkbox select) and refresh the results without reloading the page
(so that's why ajax)

can anybody help me getting started? i have most of the ajax basis
covered, i'm developing django since 2 years (more or less)... i'm
saying this so maybe we can avoid answers like "this is a beginner
tutorial for html..." i need pretty advanced guides and advices or
examples...

Yeah! Thanks everybody for the answers!

-- 
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: Optimization of a Large QuerySet iteration

2011-07-26 Thread Tom Evans
On Mon, Jul 25, 2011 at 4:57 AM, nixlists  wrote:
> Hi. I am a newbie  :)
>
> Is there a way to rewrite the dictionary code above to make it more
> readable, and/or rewrite everything in a more efficient manner in
> general? It still takes a bit of time to run (but much faster than
> doing queries inside the loop).
>
> If I am doing anything glaringly wrong, or if you have any other
> suggestions please let me know. I really appreciate your help.
>
> Thanks.
>

I've rearranged your mail to make it a bit easier to answer. You are
on the right track with your approach here, but you are doing too much
in loops, which is why you feel it is slow.


>    c = Contract.objects.get(id = contract_id)
>
>    p_per_c=c.products.all()
>
>    c_dict = dict((product.id, product.contractproduct_set.get(
>        contract=contract_id,ndc=product.id).rebate_pct)
>        for product in p_per_c)
>
>    p_dict = dict((product.id, product.contractproduct_set.get(
>        contract=contract_id, ndc=product.id).wac.wac)
>        for product in p_per_c)


So, this is the critical section of your code. You are trying to build
dictionaries of data that you can then use later on, to avoid hitting
the database repeatedly. However, the queries you use here are a bit
naive, and mean you have to do many similar queries to build up your
data sets. This is where the code can be improved.

c_dict seems to contain the product id => rebate_pct from the
appropriate ContractProduct for each Product associated with this
Contract, but it must perform one query to get the list of products,
and one query per product to get the rebate_pct. This could be
simplified - there are many ways to approach this, but I like to start
from the thing that I want - the ContractProduct:

  ContractProduct.objects.filter(contract=c)

should produce all the items we are interested in for this contract.
The next performance tip is to not fetch and create django model
instances when all you want is the data - just ask for it using
values() or values_list(), hence:

  contract_products = ContractProduct.objects.filter(contract=c)
  c_dict = dict(contract_products.values_list('product', 'rebate_pct'))

p_dict, unless I've misread, is just slightly different data from the
same data set, and hence applying the same approach:

  p_dict = dict(contract_products.values_list('product', 'wac__wac'))

This should cut down the number of queries in the view significantly.

Cheers

Tom

-- 
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: unique_together in 1.2: does it need a syncdb and does it work when saving the model?

2011-07-26 Thread Fred Janon
That explains and helps a lot, thanks Javier.

On Tue, Jul 26, 2011 at 20:31, Javier Guerra Giraldez wrote:

> On Tue, Jul 26, 2011 at 4:09 AM, fjanon  wrote:
> > - do I need to update the database schema and how do I get the
> > appropriate SQL change/patch from Django?
> > - is the unique constraint supposed to work when updating an instance
> > as well as creating a new one?
>
> unique_together creates a constraint in the database, so it would
> prevent any non-uniqueness, creating or updating.
>
> but, syncdb is the only way for Django to setup the database; and it
> won't modify existing tables.  You have to choose between:
>
> - erasing your DB table and use syncdb to create it again
>
> - manually modifying the tables in the database with ALTER TABLE.  you
> can use "manage.py sql" to see how the table should look like; but it
> won't generate the modifications for you.
>
> - South.
>
> There's also some limited model validations that do block some
> inconsistencies before hitting the database, that might be why it
> works for new instances (although i'm sure you could find some cases
> that it wouldn't catch). But ultimately, all data consistency is
> supposed to be done by the database.
>
> --
> Javier
>
> --
> 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: USE_I18N vs. USE_L10N

2011-07-26 Thread Andre Terra
On Tue, Jul 26, 2011 at 5:17 AM, Lucy Brennan 
wrote:

>
> (...)
>
> For both the USE_L10N and USE_I18N their effect is not obvious from
> their naming. I suggest, that the description of these parameters in
> https://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs are
> made more precise.
>
> From what I understand, they should have had names like
> USE_TRANSLATION and USE_LOCALIZED_FORMATTING.
>

+1 on that. Actually, I'd +over 9000 if I had the power.


Cheers,
AT

-- 
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: unique_together in 1.2: does it need a syncdb and does it work when saving the model?

2011-07-26 Thread Javier Guerra Giraldez
On Tue, Jul 26, 2011 at 4:09 AM, fjanon  wrote:
> - do I need to update the database schema and how do I get the
> appropriate SQL change/patch from Django?
> - is the unique constraint supposed to work when updating an instance
> as well as creating a new one?

unique_together creates a constraint in the database, so it would
prevent any non-uniqueness, creating or updating.

but, syncdb is the only way for Django to setup the database; and it
won't modify existing tables.  You have to choose between:

- erasing your DB table and use syncdb to create it again

- manually modifying the tables in the database with ALTER TABLE.  you
can use "manage.py sql" to see how the table should look like; but it
won't generate the modifications for you.

- South.

There's also some limited model validations that do block some
inconsistencies before hitting the database, that might be why it
works for new instances (although i'm sure you could find some cases
that it wouldn't catch). But ultimately, all data consistency is
supposed to be done by the database.

-- 
Javier

-- 
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: Database doubt

2011-07-26 Thread Kirill Spitsin
On Tue, Jul 26, 2011 at 04:50:27AM -0700, vaibhav agarwal wrote:
> Hey,
> 
> I am coding in django for the first time and I had this doubt about
> database.At the start of coding , you are not sure of all the fields
> in the models of your site. So you end up making a few fields and
> proceed . But if at some other time , you might realise that you have
> to add a new field . In such a case syncdb does not change the table
> ( maybe deleting or adding fields ) . What  should I be doing in such
> a case ?

Use South [1]_, it addresses exactly this task.

.. [1] http://south.aeracode.org/

-- 
Kirill Spitsin

-- 
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: 3-legged-OAuth Logout

2011-07-26 Thread Vignesh Sunder
I thought a lot about this when I developed my website (with Facebook
as the Server and my django-powered website as the Consumer). And what
I did was include a url to Facebook after the user logged out of my
website.

For those interested, you are invited to check out
http://www.thotvote.com. It has been developed on django-nonrel and
hosted on Google App Engine.

I also have a page on security information where I have discussed this
issue, as I felt that users need to be aware of it when they use
third-party websites with OAuth functionality.

Thanks once again for the help. Cheers !
vignesh

-- 
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: Database doubt

2011-07-26 Thread nicolas HERSOG
Hi,

I'm a beginner like you, and my database model is not over yet.
When i add new field in my models.py i make a python manage.py sqlall
 retrieve the sql and make manually the alter table.

Hope this help


On Tue, Jul 26, 2011 at 1:50 PM, vaibhav agarwal wrote:

> Hey,
>
> I am coding in django for the first time and I had this doubt about
> database.At the start of coding , you are not sure of all the fields
> in the models of your site. So you end up making a few fields and
> proceed . But if at some other time , you might realise that you have
> to add a new field . In such a case syncdb does not change the table
> ( maybe deleting or adding fields ) . What  should I be doing in such
> a case ?
>
> Thanks for the help in advance.
>
> Cheers
>
> --
> 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.



Database doubt

2011-07-26 Thread vaibhav agarwal
Hey,

I am coding in django for the first time and I had this doubt about
database.At the start of coding , you are not sure of all the fields
in the models of your site. So you end up making a few fields and
proceed . But if at some other time , you might realise that you have
to add a new field . In such a case syncdb does not change the table
( maybe deleting or adding fields ) . What  should I be doing in such
a case ?

Thanks for the help in advance.

Cheers

-- 
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 open source cashflow management app

2011-07-26 Thread Derek
On Jul 25, 8:51 pm, zodman  wrote:
> http://misgastos.zodman.com.mxits on spanish sorry.
>
> https://github.com/zodman/misgastos/
>
> On Sun, Jul 24, 2011 at 8:44 AM, mf  wrote:
> > Does anyone knows about an open source cashflow management app like
> > this one[0], built with django?.
>
> > [0]http://pulseapp.com/
>
> > Thanks for your help.
>
I get an error from that site:

uWSGI Error
wsgi application not found

-- 
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: Doubt : Redirect after registration

2011-07-26 Thread vaibhav agarwal
Hey,

@Lior Sion : No I am not using anything other than the default . IN
the database the user is created and active ( am able to login
manually as the user ) .

@Urun : Will try that out .. thanks.

Thanks

On Jul 26, 12:53 pm, Uros Trebec  wrote:
> I'm using django-registration and I solved the same problem by using
> this:
>
> http://djangosnippets.org/snippets/1960/
>
> Works like a charm :)
>
> Regards,
> Uros
>
> On Jul 26, 8:41 am, Lior Sion  wrote:
>
>
>
>
>
>
>
> > Are you using anything not defaulted, like django-registration? In the
> > database - is the user created and the active flag is true?
>
> > On Jul 24, 2:16 pm, vaibhav agarwal  wrote:
>
> > > Hi,
>
> > > I am using Django 1.3. I have started building my first site in django
> > > and it seems real fun . I am learning a lot from it . But I have a
> > > small problem . I want to login a user after he registers and then
> > > redirect him to the home page of the site . For this I tried , the
> > > stuff given in the 
> > > linkhttp://stackoverflow.com/questions/3222549/how-to-automatically-login...
> > > but it does not work for me . When I tried this , the user is directed
> > > to the home page but since that has the login_required function , it
> > > asks the user to manually login which I dont want . How do I rectify
> > > this ?
>
> > > Thanks in advance for the help .
>
> > > Cheers
>
> > > Vaibhav

-- 
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: Optimization of a Large QuerySet iteration

2011-07-26 Thread Roman Klesel
Hello,

2011/7/25 nixlists :
> Is there a way to rewrite the dictionary code above to make it more
> readable, and/or rewrite everything in a more efficient manner in
> general?

I also consider myself a beginner in programming but I've been using
django for about 1 year now.

To me the code looks quite ok and straight forward.

The main question you may ask yourself may be whether or not you
really want to have django do the whole calculation thing. Many
database engines have very powerful aggregation capabilities, support
for stored procedures, functions etc.
Some of the aggregation features are available through the django orm.

But that's a design decision that may depend on various factors.

If the db-host is powerful enough however it may speed up things quite a bit.

Regards
  Roman

-- 
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.



unique_together in 1.2: does it need a syncdb and does it work when saving the model?

2011-07-26 Thread fjanon
I added a meta option unique_together with 3 fields in a model:

unique_together = ("family_name", "given_names", "working_group")

To my surprise it worked without doing a syncdb. a sqldiff show no
difference and the check for uniqueness works when I create a new
instance, not when I update an existing one.

2 questions:

- do I need to update the database schema and how do I get the
appropriate SQL change/patch from Django?
- is the unique constraint supposed to work when updating an instance
as well as creating a new one?

Thanks

Fred

-- 
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: Managing static files - beginner's question

2011-07-26 Thread John Sheridan
Rodney,

In your settings.py file there are a couple of things you will need to
change, but none directly concerning TEMPLATE_CONTEXT_PROCESSORS.

First, you should set STATIC_ROOT to some local directory on your computer.
 eg. STATIC_ROOT = '/Users/rodney/static' .  This will be where django
copies your static files to in order to access them quickly in response to
requests.

Second, you should either set STATIC_URL to something different (you might
have some reason to change it) or else just leave it as '/static/'.  This
will be the url path to your static files.

Lastly, in the STATICSFILES_DIR list, you should include the full path to
each directory you create that will contain static files that you will be
using in the project.  You can do this either by typing in the path
explicitly, or by using os.path to input it relatively.  eg.
 os.path.join(os.path.dirname(__file__),
'templates/public').replace('\\','/'),   to do this, you will need to have '
import os.path '  included at the top of the file (settings.py).

Then you can refer to the directory using {{ STATIC_URL }} as you had
intended.

Hope that helps!

-John

On Mon, Jul 25, 2011 at 9:05 PM, Rodney Topor  wrote:

> I'm trying to learn the new way of managing static files introduced in
> version 1.3.  The documentation says that TEMPLATE_CONTEXT_PROCESSORS
> is defined to include django.core.context_processors.static by
> default, and that you can then refer to static files in your templates
> by writing something like  >.  However, the settings.py files in my new projects does *not*
> contain a definition of TEMPLATE_CONTEXT_PROCESSORS.  Should it?  If
> so, what might have gone wrong?  If not, where do I find the
> definition of TEMPLATE_CONTEXT_PROCESSORS?  (I know I can add the
> definition to settings.py to access the static files as above.)
>
> Rodney
>
> --
> 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.
>
>


-- 

John Sheridan

Harvard College Class of 2013


482 Winthrop Mail Center

Cambridge, MA 02138-7579

USA

Cell: +1 (857) 225-4086

-- 
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: memcached occasional errors

2011-07-26 Thread het.oosten
Thanks for the replies. I installed python-memcached through the
package manager. This version was outdated. I updated python-memcached
to the latest version now (1.47)

When I keep getting these error messages I will look into PyLibMC.
Anybody have any experience with PyLibMC and Django 1.2.4?

Rob

-- 
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: how to create a hidden field

2011-07-26 Thread Tom Evans
On Tue, Jul 26, 2011 at 2:18 AM, webcomm  wrote:
> I haven't been able to find anything documenting how to create a
> hidden field.  I see this is done with the HiddenField widget but
> don't know how to use that.  I tried the following but the field still
> shows...
>
> class NewsForm(ModelForm):
>    itemid =
> forms.IntegerField(widget=forms.HiddenInput,required=False)
>
>    class Meta:
>        model = News
>
>
> Thanks,
> Ryan

That would hide the field called 'itemid' from the model 'News'. Are
you saying it doesn't?

Cheers

Tom

-- 
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: drag and drop rows on django admin

2011-07-26 Thread Tom Evans
On Tue, Jul 26, 2011 at 6:32 AM, rahul jain  wrote:
> Tried this snippet but not working
>
> http://djangosnippets.org/snippets/2306/
>
> Anyone else tried it, I would like to drag and drop rows on django admin.
>
> Thanks.
>
> RJ
>

1) Resending the same message with a different subject within such a
short space of time is considered rude. People are busy, and will help
you as and when they can, be patient. If you can't be patient, people
probably won't help you.

2) "Tried  but it doesn't work" is useless. What did you try? Where
did you put the snippet? What happened? What did you expect to happen?
What were the exact error messages (if any)?

3) The comments for that snippet clearly says that it is for grapelli.
Grapelli is not django admin, it is a replacement for django admin.
It's not clear from your post whether you are even using grapelli.

Tom

2) That snippet is clearly marked

-- 
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: USE_I18N vs. USE_L10N

2011-07-26 Thread Lucy Brennan
Sorry for the late response to your reply. For some reason, I did not
get your response to my email. I only saw your answer because I went
to the online archive.

Here is a follow up for the googlers.

I have read the Django documentation, e.g.: 
https://docs.djangoproject.com/en/dev/topics/i18n/,
which in my opinion says just about the same as Wikipedia, regarding
the meaning of those two words.

The Internationalization article (https://docs.djangoproject.com/en/
dev/topics/i18n/internationalization/), explains about
internationalization in Django, but does not explain what it means to
disable/enable it. I guess that disabling internationalization means
disabling translation.

The Localization article (https://docs.djangoproject.com/en/dev/topics/
i18n/internationalization/), explains about Localization in Django,
and mentions in short about the USE_L10N parameter. Apparently it
decides if localized formatting of e.g. dates should be used.

For both the USE_L10N and USE_I18N their effect is not obvious from
their naming. I suggest, that the description of these parameters in
https://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs are
made more precise.

>From what I understand, they should have had names like
USE_TRANSLATION and USE_LOCALIZED_FORMATTING.

Lucy



On Jul 18, 1:36 pm, Shawn Milochik  wrote:
> If you look up those terms in the Django docs instead of Wikipedia I think
> that will erase your confusion.

-- 
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: [] Re: memcached occasional errors

2011-07-26 Thread Henrik Genssen
PyLibMC was introduced in django 1.3 and he is using 1.2
you need to upgrade to upgrade django to use that lib - or am I wrong?

>reply to message:
>date: 26.07.2011 09:32:19
>from: "Russell Keith-Magee" 
>to: django-users@googlegroups.com
>subject: [] Re: memcached occasional errors
>
>On Tue, Jul 26, 2011 at 2:29 PM, het.oosten  wrote:
>> On the memcached mailing list they suspected this is a Django/python
>> issue so I started a thread here. A user named dormando replied that
>> the problem below looks like a connection failure (sock has gone null)
>>
>>  I use memcached on a low traffic website with Django 1.2.4. Sometimes
>> I get this error message in my mail (full error below):
>
>This looks like it's more likely to be an issue with the Python
>wrapper to memcache that you are using, rather than an issue with
>Django. Although the stack trace occurs as a result of Django calling
>the memcache API, the call is a simple get, and it's the internals of
>memcache.py that are failing. Django doesn't do any socket-level
>manipulation of memcache, and that appears to be where the problem
>lies.
>
>It looks like you're using the native Python wrapper around memcached;
>is this correct? If so, what version of the Python memcache library
>are you using? Have you tried updating to the latest version? Have you
>tried using PyLibMC instead?
>
>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.
>

-- 
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: Doubt : Redirect after registration

2011-07-26 Thread Uros Trebec
I'm using django-registration and I solved the same problem by using
this:

http://djangosnippets.org/snippets/1960/

Works like a charm :)

Regards,
Uros

On Jul 26, 8:41 am, Lior Sion  wrote:
> Are you using anything not defaulted, like django-registration? In the
> database - is the user created and the active flag is true?
>
> On Jul 24, 2:16 pm, vaibhav agarwal  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I am using Django 1.3. I have started building my first site in django
> > and it seems real fun . I am learning a lot from it . But I have a
> > small problem . I want to login a user after he registers and then
> > redirect him to the home page of the site . For this I tried , the
> > stuff given in the 
> > linkhttp://stackoverflow.com/questions/3222549/how-to-automatically-login...
> > but it does not work for me . When I tried this , the user is directed
> > to the home page but since that has the login_required function , it
> > asks the user to manually login which I dont want . How do I rectify
> > this ?
>
> > Thanks in advance for the help .
>
> > Cheers
>
> > Vaibhav

-- 
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: memcached occasional errors

2011-07-26 Thread Russell Keith-Magee
On Tue, Jul 26, 2011 at 2:29 PM, het.oosten  wrote:
> On the memcached mailing list they suspected this is a Django/python
> issue so I started a thread here. A user named dormando replied that
> the problem below looks like a connection failure (sock has gone null)
>
>  I use memcached on a low traffic website with Django 1.2.4. Sometimes
> I get this error message in my mail (full error below):

This looks like it's more likely to be an issue with the Python
wrapper to memcache that you are using, rather than an issue with
Django. Although the stack trace occurs as a result of Django calling
the memcache API, the call is a simple get, and it's the internals of
memcache.py that are failing. Django doesn't do any socket-level
manipulation of memcache, and that appears to be where the problem
lies.

It looks like you're using the native Python wrapper around memcached;
is this correct? If so, what version of the Python memcache library
are you using? Have you tried updating to the latest version? Have you
tried using PyLibMC instead?

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: 3-legged-OAuth Logout

2011-07-26 Thread Lior Sion
That depends a lot on the ui. Facebook, for example, logs out on both
sites, while Twitter doesn't. If you're worried about a security
issue, have you "log out" button say something like "Log out of XXX"
where xxx is your site name.

Another option I've seen (when relying completely on a 3rd party log
in site) was not to allow log out at all. They let the 3rd party site
deal with that, and only allow "join".

On Jul 26, 12:04 am, Vignesh Sunder  wrote:
> Thanks for the reply..But I feel this could be a security issue,
> considering the fact that the user (say user1) would not be aware of
> the fact that he/she has not yet been logged out of Twitter. If
> another user (say user2) gets hold of the system before user1's
> cookie/session gets timed out, and happens to access Twitter.com,
> there is a bright chance that user1's information can get compromised.
> Please correct me if I am wrong in assuming that most of the users who
> browse the internet today are still 'innocent' !

-- 
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: Doubt : Redirect after registration

2011-07-26 Thread Lior Sion
Are you using anything not defaulted, like django-registration? In the
database - is the user created and the active flag is true?

On Jul 24, 2:16 pm, vaibhav agarwal  wrote:
> Hi,
>
> I am using Django 1.3. I have started building my first site in django
> and it seems real fun . I am learning a lot from it . But I have a
> small problem . I want to login a user after he registers and then
> redirect him to the home page of the site . For this I tried , the
> stuff given in the 
> linkhttp://stackoverflow.com/questions/3222549/how-to-automatically-login...
> but it does not work for me . When I tried this , the user is directed
> to the home page but since that has the login_required function , it
> asks the user to manually login which I dont want . How do I rectify
> this ?
>
> Thanks in advance for the help .
>
> Cheers
>
> Vaibhav

-- 
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.



memcached occasional errors

2011-07-26 Thread het.oosten
On the memcached mailing list they suspected this is a Django/python
issue so I started a thread here. A user named dormando replied that
the problem below looks like a connection failure (sock has gone null)

 I use memcached on a low traffic website with Django 1.2.4. Sometimes
I get this error message in my mail (full error below):

AttributeError: 'NoneType' object has no attribute 'recv'

I use memcache to cache some Twitter messages. I fetch them using this
in a context-preprocessor:
def latest_tweet( request ):
tweet = cache.get( 'tweet_mysite_nl' )

if tweet:
return {"tweet": tweet}
else:
tweet = {}
return {"tweet": tweet}

I tried to trigger this error hitting refresh all the time, but with
my pc everything works fine.

I update the cache twice an hour with another view, using cron
(because I don't want to rely on an external site for performance):

def update_tweet(request):
import time
from django.conf import settings
from django.core.cache import cache
import twitter
tweet = twitter.Api().GetUserTimeline( settings.TWITTER_USER,
count=5 )
for s in tweet:
s.date =
datetime.datetime(*(time.strptime( s.created_at, "%a %$
cache.set( 'tweet_mysite_nl', tweet,
settings.TWITTER_TIMEOUT )
return HttpResponseRedirect('mysite')

Here is the full error message:

Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/django/core/handlers/
base.py", line 100, in get_response
response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/lib/python2.4/site-packages/django/views/generic/
simple.py", line 16, in direct_to_template
c = RequestContext(request, dictionary)

  File "/usr/lib/python2.4/site-packages/django/template/context.py",
line 149, in __init__
self.update(processor(request))

  File "/home/wieskamp/django/wieskamp/verkoop/context_processors.py",
line 8, in latest_tweet
tweet = cache.get( 'tweet_mysite_nl' )

  File "/usr/lib/python2.4/site-packages/django/core/cache/backends/
memcached.py", line 48, in get
val = self._cache.get(smart_str(key))

  File "/usr/lib/python2.4/site-packages/memcache.py", line 337, in
get
rkey, flags, rlen, = self._expectvalue(server)

  File "/usr/lib/python2.4/site-packages/memcache.py", line 411, in
_expectvalue
line = server.readline()

  File "/usr/lib/python2.4/site-packages/memcache.py", line 511, in
readline
recv = self.socket.recv

AttributeError: 'NoneType' object has no attribute 'recv'

-- 
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.