Re: Problems installing south as part of django-cms

2010-12-09 Thread Ilian Iliev
Check whether the toolbar directory has __init__.py in it. Then try

from cms.middleware import toolbar


On Fri, Dec 10, 2010 at 12:20 AM, wilbur  wrote:

> I have checked my python path, and I see:
>
> /usr/local/lib/python2.6/dist-packages/django_cms-2.1.0.beta3-
> py2.6.egg
>
> as one of the directories. If i point to the module I want with:
>
>'cms.middleware.toolbar.ToolbarMiddleware',(##and this path
> DOES exist in the directory structure)
>
> in my MIDDLEWARE_CLASSES, I still get the error:
>
> ImproperlyConfigured: Error importing middleware
> cms.middleware.toolbar: "No module named toolbar"
>
> And, if I go into my Django shell, and type:
>
> import sys
> sys.path (##shows the same python path as above)
> from cms.middleware.toolbar import *
>
> I get:
>
> ImportError: No module named toolbar
>
> I don't understand!
>
> Thanks
>
> On Dec 9, 2:35 pm, Ilian Iliev  wrote:
> > Hi,
> >
> > the problem look to be that cms is not in your python path.
> > It should work without hard copying it in other directory.
> > Are you able to import this middleware from the python interpeter?
> > If not check your python path.
> >
> >
> >
> > On Thu, Dec 9, 2010 at 11:25 PM, wilbur  wrote:
> > > Hello and thank you,
> >
> > > Removing south worked fine. I initially had problems loading
> > > middleware classes to settings.py for the following:
> >
> > >#'cms.middleware.page.CurrentPageMiddleware',
> > >#'cms.middleware.user.CurrentUserMiddleware',
> > >#'cms.middleware.toolbar.ToolbarMiddleware',
> > >#'cms.middleware.media.PlaceholderMediaMiddleware',
> >
> > > I subsequently hard copied the cms middleware modules to :
> >
> > > /usr/lib/pymodules/python2.6/django/middleware/cms/middleware
> >
> > > with the following settings.py entries:
> >
> > >'django.middleware.cms.middleware.page.CurrentPageMiddleware',
> > >'django.middleware.cms.middleware.user.CurrentUserMiddleware',
> > >'django.middleware.cms.middleware.toolbar.ToolbarMiddleware',
> >
> > > 'django.middleware.cms.middleware.media.PlaceholderMediaMiddleware',
> > >'django.middleware.cache.FetchFromCacheMiddleware',
> >
> > > But, now I get the error:
> >
> > > CMS Permission system requires
> > > cms.middleware.user.CurrentUserMiddleware.
> > > Please put it into your MIDDLEWARE_CLASSES in settings file
> >
> > > I have verified that the paths are correct, and the
> > > CurrentUserMiddleware class exists in the user module??
> >
> > > Thanks
> >
> > > On Dec 9, 1:00 pm, Ilian Iliev  wrote:
> > > > The simplest solution:
> >
> > > > remove south from the list of installed application, run
> > > > ./manage.py syncdb
> > > > this will create you tables the way thay have to be and everything
> will
> > > > be ok.
> > > > This will not fix your south problem, but will allow you to use
> django
> > > cms.
> > > > If you later fix the south, just run
> > > > ./manage.py migrate cms --fake
> >
> > > > to fake all cms migrations currently in the project.
> >
> > > > On Thu, Dec 9, 2010 at 7:13 PM, wilbur  wrote:
> > > > > Hello,
> >
> > > > > I am having a hell of a time getting Django-CMS up and running. I
> am
> > > > > using Django 1.1.1, and South 0.7.3 (by way of using easy_install
> > > > > south systemwide, though my Ubuntu synaptic package manager says
> > > > > 0.6-1) on Ubuntu 10.04 (Lucid). I am following the CMS tutorial at
> > > > >http://readthedocs.org/projects/ojii/django-cms/docs/tutorial.html.
> > > > > When I try to run import south from the manage.py shell, I get the
> > > > > following error:
> >
> > > > > There is no South database module
> > > > > 'south.db.south.db.django.db.backends.postgresql_psycopg2' for your
> > > > > database. Please either choose a supported database, check for
> > > > > SOUTH_DATABASE_ADAPTER[S] settings, or remove South from
> > > > > INSTALLED_APPS.
> >
> > > > > I have south in the INSTALLED_APPS, and my database in settings.py
> is:
> >
> > > > > DATABASE_ENGINE = 'django.db.backends.postgresql_psycopg2'
> >
> > > > > Any detailed help would be much appreciated,
> >
> > > > > Bill
> >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "Django users" group.
> > > > > To post to this group, send email to django-users@googlegroups.com
> .
> > > > > To unsubscribe from this group, send email to
> > > > > django-users+unsubscr...@googlegroups.com
> 
> >
> > > 
> 
> >
> >
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/django-users?hl=en.
> >
> > > > --
> > > > eng. Ilian 

problem writing a unittest

2010-12-09 Thread Kenneth Gonsalves
hi,

I am trying to write a unittest, but am getting an error. 

django version - trunk
model:

class Nums(models.Model):

num1 = models.IntegerField("First number")
num2 = models.IntegerField("Second number")
def addit(self):
return self.num1+self.num2

test:

from django.utils import unittest
from addnums.models import Nums

class TestNums(unittest.TestCase):
def setup(self):
"""create a model and test if the result is correct"""
self.tnum = Nums.objects.create(num1=1,num2=2)

def testaddit(self):
self.assertEqual(self.tnum.addit(),"3")

and the error is:

Traceback (most recent call last):
  File "/home/lawgon/addition/../addition/addnums/tests.py", line 18, in
testaddit
self.assertEqual(self.tnum.addit(),"3")
AttributeError: 'TestNums' object has no attribute 'tnum'

any clues?
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 Team Project Best Practices

2010-12-09 Thread Kenneth Gonsalves
On Thu, 2010-12-09 at 17:26 -0800, acat...@gmail.com wrote:
> the only
> explanation I can give is that I would be having all of the project's
> files and folders in the standard django project folder. 

that is correct - in a project everyone has to be able to see what
everyone else is doing - or how would the project run?? Maybe in a huge
project on something ultra secret, the other approach would be feasible.
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File upload fail on live server

2010-12-09 Thread Kenneth Gonsalves
On Thu, 2010-12-09 at 14:57 +0200, Sithembewena Lloyd Dube wrote:
> Thanks Kenneth. I tried your recommendation, the file is not uploaded
> at
> all. I'm stumped by this, as
> the folder is writable by apache. I will post on here when I do
> implement a
> fix.
> 
> 

do one thing - make the file required and not optional, then django will
barf and tell you where you have gone wrong
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: newbie question: @login_required, can't get it to work

2010-12-09 Thread Charlietuna
Thank you sooo much. That was great. I was using a book base
on Django .96. I couldn't fully understand the online documentation.

You saved me a great deal of time.

Steve

On Dec 8, 11:20 pm, robin nanola  wrote:
> on your settings.py you can just add  LOGIN_URL = '/login/'
>
> On Thu, Dec 9, 2010 at 3:04 PM, Charlietuna  wrote:
> > Hi All,
>
> > I'm a newbie. I would like to use the @login_required decorator, but I
> > don't want to redirect to the standard default accounts/login. I would
> > like to redirect to '/login/'
>
> > The book says add the following to the end of the settings.py file.:
>
> > import django.contrib.auth
> > django.contrib.auth.LOGIN_URL = '/login/'
>
> > The server says: GET /accounts/login/?login/=/save/ HTTP/1.1  404 2273
> > I assume that it is going the path:
>
> > /account/login/login
>
> > Any help would be appreciated!
>
> > Thanks,
>
> > Steve
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@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-us...@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: newbie question: @login_required, can't get it to work

2010-12-09 Thread Charlietuna
Thank you sooo much. That was great. I was using a book base
on Django .96. I couldn't fully understand the online documentation.

You saved me a great deal of time.

Steve

On Dec 8, 11:22 pm, Martin Melin  wrote:
> On Thu, Dec 9, 2010 at 8:04 AM, Charlietuna  wrote:
> > Hi All,
>
> > I'm a newbie. I would like to use the @login_required decorator, but I
> > don't want to redirect to the standard default accounts/login. I would
> > like to redirect to '/login/'
>
> > The book says add the following to the end of the settings.py file.:
>
> > import django.contrib.auth
> > django.contrib.auth.LOGIN_URL = '/login/'
>
> Not sure where you're getting this information from, but assuming
> you're using the latest Django:
>
> http://docs.djangoproject.com/en/dev/ref/settings/#std:setting-LOGIN_URL
>
> i.e. you should be using settings.LOGIN_URL and not
> django.contrib.auth.LOGIN_URL since at least 1.0
>
> Cheers,
> Martin Melin
>
>
>
> > The server says: GET /accounts/login/?login/=/save/ HTTP/1.1  404 2273
> > I assume that it is going the path:
>
> > /account/login/login
>
> > Any help would be appreciated!
>
> > Thanks,
>
> > Steve

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Returning value directly to another function

2010-12-09 Thread Rainy


On Dec 9, 9:21 am, Quetzacotl  wrote:
> Hello, this is rather python problem, but maybe You can help. What i
> want to do is to return value in another function calling from other
> function.
>
> It doesnt mean i want this:
>
> def Func():
>      return 1
>
> def Func2():
>      return Func()
>
> I want function Func to return 1 directly in Func2 as it is Func2
> returning it.
>
> I have this problem because view function has to return response
> object and my function that adds element to database (comments)
> returns HttpResponseRedirect or context dict with form that has
> errors.
> If it returns redirect then i want view function to return it, if it
> return context then i dont want to return it but rather give it to
> render_to_response.
>
> It comes to this:
>
> def Add():
>      #form valid, add to db
>      return { 'redirect': HttpResponseRedirect('url'), }
>
>      #form not valid
>      return { 'form': form, 'redirect': 0, }
>
> def View(request):
>      add = Add()
>      if add['redirect']!=0:
>           return add['redirect']
>
>      return render_to_response(template,add)
>
> Thing i dont want here is if statement checking if there is redirect,
> so i want within function Add return HttpResponseRedirect as it is
> View function.
>
> I dont know if this is possible.

You can use isinstance() function to check if returned value is
an instance of some class, and make for simpler code:

obj = add()
if isinstance(Cls, obj): return obj
..
return render_to_response(template, obj)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 Team Project Best Practices

2010-12-09 Thread Rainy


On Dec 9, 8:26 pm, "acat...@gmail.com"  wrote:
> I have been using Django for a little over two years as a freelance
> developer.  I am currently working at a company where I am at the
> beginning stages of a two-person Django app.  I have worked on group
> projects before, quite some time ago, as an html editor.  I definitely
> don't have experience at developing a two-person Django project. I
> have he envisioned initiating a django project, initiating an empty
> app under that project, establishing template and static folders in
> the project.  After then I figured I would add the project to a github
> repository then have my co-worker clone the project.  After that we
> could work away on separate branches and merge when ready.  My co-
> worker wants to have the repository only have the app part of the
> project and the app will contain media and static folders.  Each
> developer would have a project root with only manage.py, urls.py and
> the clone app.  His thinking that this fits the Django way of doing
> things more closely, but I don't see it this way and the only
> explanation I can give is that I would be having all of the project's
> files and folders in the standard django project folder.  I would
> greatly appreciate hearing from anyone with insight or advice.  Thanks
> in advance.


His reasoning sounds very odd to me. What about sharing stuff between
different apps? There's nothing in django that says a single app
should be in a repo. The point of an app is that it's portable and can
be moved around and other apps can use parts of it as needed. Repo
setup depends on what changes you will need to share, if you're
absolutely sure you'll only need to work on one app and it won't use
anything from other apps, and you won't need to add custom app
settings to settings.py, I guess it's ok but I don't see the point.

For what its worth, I've been working with repos that contained django
projects in two places and it works just fine. (and in fact it
wouldn't work otherwise for the reasons I mentioned.)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 on a hosting service

2010-12-09 Thread Todd Wilson
A couple of weeks ago I sent the message quoted below to the list.  One
reader (Daniel Roseman) replied and suggested that I might not need to
ask the hosting service to install anything, quoting documentation from
the FastCGI section, but it seemed to me (as explained in my reply on
11/28/2010) that mod_fastcgi had to be installed, which it isn't (or at
least it's not in /etc/apache2/mods-available/).

Anyway, I got through to the hosting provider's tech support with my
request and got this reply:

   According to Django requirements (http://packages.debian.org/lenny
   /python-django) and our experience there is no need to have
   mod_python or mod_wsgi installed on the server.  So, you could
   try to run Django web site on the server.  If any problem arises we
   will install the mod_wsgi module.

I wonder if they are referring to the development server here.  Please
correct me if I'm wrong, but I understood from the documentation that a
vanilla installation of Apache would not be sufficient to deploy
production Django applications, except possibly through (old-fashioned)
CGI:  some form of integration (mod_wsgi, mod_python, mod_fastcgi, ...)
would be needed.  Is that right?

In any case, they are willing to install mod_wsgi.  Not being very
familiar with Apache configuration, can someone tell me how much of the
WSGI configuration mentioned in the Django docs for WSGI deployment
(http://docs.djangoproject.com/en/1.2/howto/deployment/modwsgi/) can be
done with an .htaccess file, and how much I will have to ask them to do
for me?

Thanks,

--Todd

Todd Wilson wrote, on 11/27/2010 07:20 PM:
> I'm helping some friends improve a portal website they have created
> using PHP, but which would be ideal for Django, in the sense that a lot
> of the work they've already done, and would like to do as they improve
> the site, would be easy to do in Django.  They have a hosting contract
> with Intermedia (http://www.intermedia.net/) and would very much like to
> keep it.  I've gotten ssh access to their server and went poking around
> a bit, and, although python is available on the server (version 2.5.2),
> there doesn't seem to be any support for WSGI, mod_python, FastCGI, or
> the other deployment options listed in the documentation (at least I
> didn't see them in /etc/apache2/mods-available/), and it doesn't look
> like they support other frameworks (Rails, Drupal, Zope) either.
> 
> My question:  I've always set up my own servers and don't have any
> experience with web hosting;  is there a minimal sort of request that I
> could make to Intermedia that, if granted, would make it possible for me
> (and presumably others) to deploy a Django site using their service, or
> should I just try to convince my friends to find a different hosting
> service?  It seems like there would be many to choose from:
> 
>http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts
> 
> Thanks,
> 
> --Todd
> 
> 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Generic Views - do you use them?

2010-12-09 Thread Rainy
On Nov 8, 6:42 pm, Ted  wrote:
> What are their pros and cons?  How often do you use them when you're
> coding?
>
> The more I code in django the less I find generic views to be useful
> shortcuts (direct to template being the exception).
>
> My biggest complaints are:
> * You don't end up saving many keystrokes unless you have 3 or more
> views that are going to use the same info_dict.
> * They can't be tweaked or changed much before you have to move the
> code to the views file, destroying the keystroke savings.
> * Second syntax for doing the same thing makes Django harder to
> learn.
>
> Am I alone on this?
>
> I've thought about it and i think there is a better way.  I want to
> see if there are others in the community who aren't in love with
> generic views before I develop the alternate approach.
>
> I'm not trying to start a flame war.

They may be useful sometimes but I've never needed them
as I usually work on open-ended projects that would grow
out of generic views soon even if they may be possible to
use at first.

I think there's a problem with the way generic views are
introduced in documentation. I've actually tutored someone
on use of Django and we ran into a problem that they
started using generic views and kept asking me how to
do this or that with them and they could do almost nothing
they wanted. I could see it was frustrating for the student.

I think the docs should either completely move generic
views into some optional section or there should be an
extremely clear and explicit walkthrough of their limits
and a disclaimer that you shouldn't use them unless
you're pretty sure they can do everything you need your
app to do.

I think I've seen a web talk by Adrian where he said
generic views were introduced for designers (i.e.
non-programmers) to make it possible to make a
useful app with no programming at all. I don't have
a problem with that at all. The main issue is how the docs
approach generic views..

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 Team Project Best Practices

2010-12-09 Thread satyandra babu
if you have many modules in projects then set one app for each module will
be easy but still that app will be part of your django project, for example
accounts, registration, userprofile and others if you your project is
concern about users but if your project is small enough you can go with one
app as well.

having different app in same project give you proper hierarchy  for the
project, and it is east to handle.



On Fri, Dec 10, 2010 at 6:56 AM, acat...@gmail.com wrote:

> I have been using Django for a little over two years as a freelance
> developer.  I am currently working at a company where I am at the
> beginning stages of a two-person Django app.  I have worked on group
> projects before, quite some time ago, as an html editor.  I definitely
> don't have experience at developing a two-person Django project. I
> have he envisioned initiating a django project, initiating an empty
> app under that project, establishing template and static folders in
> the project.  After then I figured I would add the project to a github
> repository then have my co-worker clone the project.  After that we
> could work away on separate branches and merge when ready.  My co-
> worker wants to have the repository only have the app part of the
> project and the app will contain media and static folders.  Each
> developer would have a project root with only manage.py, urls.py and
> the clone app.  His thinking that this fits the Django way of doing
> things more closely, but I don't see it this way and the only
> explanation I can give is that I would be having all of the project's
> files and folders in the standard django project folder.  I would
> greatly appreciate hearing from anyone with insight or advice.  Thanks
> in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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 Team Project Best Practices

2010-12-09 Thread acat...@gmail.com
I have been using Django for a little over two years as a freelance
developer.  I am currently working at a company where I am at the
beginning stages of a two-person Django app.  I have worked on group
projects before, quite some time ago, as an html editor.  I definitely
don't have experience at developing a two-person Django project. I
have he envisioned initiating a django project, initiating an empty
app under that project, establishing template and static folders in
the project.  After then I figured I would add the project to a github
repository then have my co-worker clone the project.  After that we
could work away on separate branches and merge when ready.  My co-
worker wants to have the repository only have the app part of the
project and the app will contain media and static folders.  Each
developer would have a project root with only manage.py, urls.py and
the clone app.  His thinking that this fits the Django way of doing
things more closely, but I don't see it this way and the only
explanation I can give is that I would be having all of the project's
files and folders in the standard django project folder.  I would
greatly appreciate hearing from anyone with insight or advice.  Thanks
in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 session InvalidOperation

2010-12-09 Thread satyandra babu
MySQLdb is required to use MySQL with python, so but the error is same as
check to import mysqldb if it working fine, i hope the issue is somewhere
mysqldb settings only.


 On Fri, Dec 10, 2010 at 5:58 AM, kinder  wrote:

> Ummm... did you mean to say something before the 'for using'? Should I
> not use MySQLdb (I'm using version 1.2.2)?
>
> On Dec 9, 5:31 pm, satyandra babu  wrote:
> > Hi,
> >
> > for using MySQl with python MySQLdb and it will work fine :)
> >
> > enjoy coding.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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.



Double slash in URL

2010-12-09 Thread Igor Rubinovich
Hi,

I'm relying on double slashes for certain things in my Django app and
it's fine on my maching, but just discovered the hosting environment
is reducing double slashes to single.

Any idea how I can keep them using mod_rewrite? I'm trying something
like

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ ([^ ]+) HTTP/
RewriteRule ^(.*)$ django.fcgi/%1 [QSA,L]

but am getting it wrong obviously.,

There's no condition, I just always want to keep them.

Thanks for ideas.
Igor

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 session InvalidOperation

2010-12-09 Thread kinder
Ummm... did you mean to say something before the 'for using'? Should I
not use MySQLdb (I'm using version 1.2.2)?

On Dec 9, 5:31 pm, satyandra babu  wrote:
> Hi,
>
> for using MySQl with python MySQLdb and it will work fine :)
>
> enjoy coding.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 session InvalidOperation

2010-12-09 Thread satyandra babu
Hi,

for using MySQl with python MySQLdb and it will work fine :)

enjoy coding.

On Fri, Dec 10, 2010 at 4:48 AM, kinder  wrote:

> Hi Dan,
>
> Thanks for taking a look... here's the copy-and-paste stack trace.
>
> ==
>
> Environment:
>
> Request Method: POST
> Request URL: http://sitename.com/admin/
> Django Version: 1.0.4
> Python Version: 2.5.5
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.flatpages',
>  'django.contrib.admin',
>  'django_extensions',
>  'analytics',
>  'attachments',
>  'contact',
>  'dashboard',
>  'donate',
>  'filebrowser',
>  'minicontent',
>  'news',
>  'pagination',
>  'partners',
>  'social_aggregator',
>  'tagging',
>  'news_video',
>  'utils',
>  'volunteers']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
>  'pagination.middleware.PaginationMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.5/site-packages/django/core/handlers/
> base.py" in get_response
>  91. response = callback(request, *callback_args,
> **callback_kwargs)
> File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/
> sites.py" in root
>  141. if not self.has_permission(request):
> File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/
> sites.py" in has_permission
>  100. return request.user.is_authenticated() and
> request.user.is_staff
> File "/usr/local/lib/python2.5/site-packages/django/contrib/auth/
> middleware.py" in __get__
>  5. request._cached_user = get_user(request)
> File "/usr/local/lib/python2.5/site-packages/django/contrib/auth/
> __init__.py" in get_user
>  83. user_id = request.session[SESSION_KEY]
> File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/
> backends/base.py" in __getitem__
>  46. return self._session[key]
> File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/
> backends/base.py" in _get_session
>  172. self._session_cache = self.load()
> File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/
> backends/db.py" in load
>  16. expire_date__gt=datetime.datetime.now()
> File "/usr/local/lib/python2.5/site-packages/django/db/models/
> manager.py" in get
>  117. return self.get_query_set().get(*args, **kwargs)
> File "/usr/local/lib/python2.5/site-packages/django/db/models/
> query.py" in get
>  317. num = len(clone)
> File "/usr/local/lib/python2.5/site-packages/django/db/models/
> query.py" in __len__
>  173. self._result_cache = list(self.iterator())
> File "/usr/local/lib/python2.5/site-packages/django/db/models/
> query.py" in iterator
>  288. for row in self.query.results_iter():
> File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/
> query.py" in results_iter
>  205. for rows in self.execute_sql(MULTI):
> File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/
> query.py" in execute_sql
>  1820. cursor.execute(sql, params)
> File "/usr/local/lib/python2.5/site-packages/django/db/backends/
> util.py" in execute
>  19. return self.cursor.execute(sql, params)
> File "/usr/local/lib/python2.5/site-packages/django/db/backends/mysql/
> base.py" in execute
>  83. return self.cursor.execute(query, args)
> File "build/bdist.linux-i686/egg/MySQLdb/cursors.py" in execute
>  166. self.errorhandler(self, exc, value)
> File "build/bdist.linux-i686/egg/MySQLdb/connections.py" in
> defaulterrorhandler
>  35. raise errorclass, errorvalue
>
> Exception Type: InvalidOperation at /admin/
> Exception Value: Invalid literal for Decimal: '2010-12-23 16:53:08'
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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 session InvalidOperation

2010-12-09 Thread kinder
Hi Dan,

Thanks for taking a look... here's the copy-and-paste stack trace.

==

Environment:

Request Method: POST
Request URL: http://sitename.com/admin/
Django Version: 1.0.4
Python Version: 2.5.5
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.flatpages',
 'django.contrib.admin',
 'django_extensions',
 'analytics',
 'attachments',
 'contact',
 'dashboard',
 'donate',
 'filebrowser',
 'minicontent',
 'news',
 'pagination',
 'partners',
 'social_aggregator',
 'tagging',
 'news_video',
 'utils',
 'volunteers']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
 'pagination.middleware.PaginationMiddleware')


Traceback:
File "/usr/local/lib/python2.5/site-packages/django/core/handlers/
base.py" in get_response
  91. response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/
sites.py" in root
  141. if not self.has_permission(request):
File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/
sites.py" in has_permission
  100. return request.user.is_authenticated() and
request.user.is_staff
File "/usr/local/lib/python2.5/site-packages/django/contrib/auth/
middleware.py" in __get__
  5. request._cached_user = get_user(request)
File "/usr/local/lib/python2.5/site-packages/django/contrib/auth/
__init__.py" in get_user
  83. user_id = request.session[SESSION_KEY]
File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/
backends/base.py" in __getitem__
  46. return self._session[key]
File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/
backends/base.py" in _get_session
  172. self._session_cache = self.load()
File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/
backends/db.py" in load
  16. expire_date__gt=datetime.datetime.now()
File "/usr/local/lib/python2.5/site-packages/django/db/models/
manager.py" in get
  117. return self.get_query_set().get(*args, **kwargs)
File "/usr/local/lib/python2.5/site-packages/django/db/models/
query.py" in get
  317. num = len(clone)
File "/usr/local/lib/python2.5/site-packages/django/db/models/
query.py" in __len__
  173. self._result_cache = list(self.iterator())
File "/usr/local/lib/python2.5/site-packages/django/db/models/
query.py" in iterator
  288. for row in self.query.results_iter():
File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/
query.py" in results_iter
  205. for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/
query.py" in execute_sql
  1820. cursor.execute(sql, params)
File "/usr/local/lib/python2.5/site-packages/django/db/backends/
util.py" in execute
  19. return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.5/site-packages/django/db/backends/mysql/
base.py" in execute
  83. return self.cursor.execute(query, args)
File "build/bdist.linux-i686/egg/MySQLdb/cursors.py" in execute
  166. self.errorhandler(self, exc, value)
File "build/bdist.linux-i686/egg/MySQLdb/connections.py" in
defaulterrorhandler
  35. raise errorclass, errorvalue

Exception Type: InvalidOperation at /admin/
Exception Value: Invalid literal for Decimal: '2010-12-23 16:53:08'

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Beta page and "under construction"

2010-12-09 Thread Christophe Pettus

On Dec 9, 2010, at 2:56 PM, Álex González wrote:
> I like to upload my beta page to a server, but I only want to show this beta 
> to certains IPs. If get the IP of the cliente could be possible in the 
> urls.py file this will be easy, but I can't do that.

This seems like a good application for a customer middleware module that 
redirects to the beta page on the basis of the IP.

--
-- Christophe Pettus
   x...@thebuild.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Beta page and "under construction"

2010-12-09 Thread Álex González
Hi!

I like to upload my beta page to a server, but I only want to show this beta
to certains IPs. If get the IP of the cliente could be possible in the
urls.py file this will be easy, but I can't do that.

I read about request.META, really I'm using it on certain views, but in
urls.py I can't do that.

My idea is create a different urlpatterns depending of the IP or if someone
have another idea I'm really interesting in hear it.

Thanks!

-- 
@agonzalezro 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Errors in modelForm

2010-12-09 Thread robos85
I found that I can do it when I declare form based on model. But then I
must rewrite all other errors and requirements.
Is there any better way?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Problems installing south as part of django-cms

2010-12-09 Thread wilbur
I have checked my python path, and I see:

/usr/local/lib/python2.6/dist-packages/django_cms-2.1.0.beta3-
py2.6.egg

as one of the directories. If i point to the module I want with:

'cms.middleware.toolbar.ToolbarMiddleware',(##and this path
DOES exist in the directory structure)

in my MIDDLEWARE_CLASSES, I still get the error:

ImproperlyConfigured: Error importing middleware
cms.middleware.toolbar: "No module named toolbar"

And, if I go into my Django shell, and type:

import sys
sys.path (##shows the same python path as above)
from cms.middleware.toolbar import *

I get:

ImportError: No module named toolbar

I don't understand!

Thanks

On Dec 9, 2:35 pm, Ilian Iliev  wrote:
> Hi,
>
> the problem look to be that cms is not in your python path.
> It should work without hard copying it in other directory.
> Are you able to import this middleware from the python interpeter?
> If not check your python path.
>
>
>
> On Thu, Dec 9, 2010 at 11:25 PM, wilbur  wrote:
> > Hello and thank you,
>
> > Removing south worked fine. I initially had problems loading
> > middleware classes to settings.py for the following:
>
> >    #'cms.middleware.page.CurrentPageMiddleware',
> >    #'cms.middleware.user.CurrentUserMiddleware',
> >    #'cms.middleware.toolbar.ToolbarMiddleware',
> >    #'cms.middleware.media.PlaceholderMediaMiddleware',
>
> > I subsequently hard copied the cms middleware modules to :
>
> > /usr/lib/pymodules/python2.6/django/middleware/cms/middleware
>
> > with the following settings.py entries:
>
> >    'django.middleware.cms.middleware.page.CurrentPageMiddleware',
> >    'django.middleware.cms.middleware.user.CurrentUserMiddleware',
> >    'django.middleware.cms.middleware.toolbar.ToolbarMiddleware',
>
> > 'django.middleware.cms.middleware.media.PlaceholderMediaMiddleware',
> >    'django.middleware.cache.FetchFromCacheMiddleware',
>
> > But, now I get the error:
>
> > CMS Permission system requires
> > cms.middleware.user.CurrentUserMiddleware.
> > Please put it into your MIDDLEWARE_CLASSES in settings file
>
> > I have verified that the paths are correct, and the
> > CurrentUserMiddleware class exists in the user module??
>
> > Thanks
>
> > On Dec 9, 1:00 pm, Ilian Iliev  wrote:
> > > The simplest solution:
>
> > > remove south from the list of installed application, run
> > > ./manage.py syncdb
> > > this will create you tables the way thay have to be and everything will
> > > be ok.
> > > This will not fix your south problem, but will allow you to use django
> > cms.
> > > If you later fix the south, just run
> > > ./manage.py migrate cms --fake
>
> > > to fake all cms migrations currently in the project.
>
> > > On Thu, Dec 9, 2010 at 7:13 PM, wilbur  wrote:
> > > > Hello,
>
> > > > I am having a hell of a time getting Django-CMS up and running. I am
> > > > using Django 1.1.1, and South 0.7.3 (by way of using easy_install
> > > > south systemwide, though my Ubuntu synaptic package manager says
> > > > 0.6-1) on Ubuntu 10.04 (Lucid). I am following the CMS tutorial at
> > > >http://readthedocs.org/projects/ojii/django-cms/docs/tutorial.html.
> > > > When I try to run import south from the manage.py shell, I get the
> > > > following error:
>
> > > > There is no South database module
> > > > 'south.db.south.db.django.db.backends.postgresql_psycopg2' for your
> > > > database. Please either choose a supported database, check for
> > > > SOUTH_DATABASE_ADAPTER[S] settings, or remove South from
> > > > INSTALLED_APPS.
>
> > > > I have south in the INSTALLED_APPS, and my database in settings.py is:
>
> > > > DATABASE_ENGINE = 'django.db.backends.postgresql_psycopg2'
>
> > > > Any detailed help would be much appreciated,
>
> > > > Bill
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Django users" group.
> > > > To post to this group, send email to django-us...@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.
>
> > > --
> > > eng. Ilian Iliev
> > > Web Software Developer
>
> > > Mobile: +359 88 66 08 400
> > > Website: ilian.i-n-i.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-us...@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.
>
> --
> eng. Ilian Iliev
> Web Software Developer
>
> Mobile: +359 88 66 08 400
> Website: 

Django Form ChoiceField, initial not working

2010-12-09 Thread Sector7B
Hi, i have a simple form:
class StoreLocationHoursForm(BForm):
location = forms.ChoiceField(required=True)
day = forms.ChoiceField(choices=bagit_constants.dow,required=True)
time_open_hours =
forms.ChoiceField(choices=constants.hours,required=True)
time_open_minutes =
forms.ChoiceField(choices=constants.minutes,required=True)
time_close_hours =
forms.ChoiceField(choices=constants.hours,required=True)
time_close_minutes =
forms.ChoiceField(choices=constants.minutes,required=True)

there can be many locations, so in my view i loop through them to
create a list of tuples to provide a choices list for location:
Log Output of the list when im done:sl_list= [('-', 'Choose
Location'), (u'Super City', u'901 PHILADELPHIA STREET')]

the code i use to set initial is the following:

form = StoreLocationHoursForm(initial={"location":sl_list})

However my select is empty when it renders the HTML.

Thanks for the help in advance,

j

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Create new entry on first save of different model

2010-12-09 Thread Nick
Nevermind. I think I got it.

On Dec 9, 3:57 pm, Nick  wrote:
> Thanks for the reply. I'm working on the override. How to I affect a
> model from the save of another model.
>
> On Dec 9, 3:37 pm, Ilian Iliev  wrote:
>
> > Hi,
>
> > you can overload the save method of Model1 in a way
> > that it checks type and if it is machine, create two record in Model2.
>
> > --
> > eng. Ilian Iliev
> > Web Software Developer
>
> > Mobile: +359 88 66 08 400
> > Website: ilian.i-n-i.org
>
> > On Thu, Dec 9, 2010 at 11:21 PM, Nick  wrote:
> > > I am working on a project in which I need to evaluate a field in one
> > > model and based on its values add entries to another model. I don't
> > > quite now how to succinctly put that into words which is why searching
> > > for a solution has been so annoying.
>
> > > Here is my example
>
> > > Type_Choices = (
> > >    ('Person', 'Person'),
> > >    ('Machine', 'Machine'),
> > >    )
>
> > > class Model1(models.Model):
> > >    type = models.CharField(max_length=100, choices=Type_Choices)
> > >    name = models.CharField(max_length=100)
>
> > > class Model2(models.Model):
> > >    person_job = models.CharField()
> > >    machine_job = models.CharField()
>
> > > what I'd like to do is evaluate type on Model 1 when and entry is
> > > first created and then if it evaluates to Machine create two new
> > > entries in Model2. One for  machine_job = primary and one for
> > > machine_job = secondary. I only want this to fire on the initial save
> > > of the Model1 object.
>
> > > Any help with actual code examples or ways of phrasing this so as not
> > > to confuse google is appreciated.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-us...@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-us...@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: Create new entry on first save of different model

2010-12-09 Thread Nick
Thanks for the reply. I'm working on the override. How to I affect a
model from the save of another model.

On Dec 9, 3:37 pm, Ilian Iliev  wrote:
> Hi,
>
> you can overload the save method of Model1 in a way
> that it checks type and if it is machine, create two record in Model2.
>
> --
> eng. Ilian Iliev
> Web Software Developer
>
> Mobile: +359 88 66 08 400
> Website: ilian.i-n-i.org
>
> On Thu, Dec 9, 2010 at 11:21 PM, Nick  wrote:
> > I am working on a project in which I need to evaluate a field in one
> > model and based on its values add entries to another model. I don't
> > quite now how to succinctly put that into words which is why searching
> > for a solution has been so annoying.
>
> > Here is my example
>
> > Type_Choices = (
> >    ('Person', 'Person'),
> >    ('Machine', 'Machine'),
> >    )
>
> > class Model1(models.Model):
> >    type = models.CharField(max_length=100, choices=Type_Choices)
> >    name = models.CharField(max_length=100)
>
> > class Model2(models.Model):
> >    person_job = models.CharField()
> >    machine_job = models.CharField()
>
> > what I'd like to do is evaluate type on Model 1 when and entry is
> > first created and then if it evaluates to Machine create two new
> > entries in Model2. One for  machine_job = primary and one for
> > machine_job = secondary. I only want this to fire on the initial save
> > of the Model1 object.
>
> > Any help with actual code examples or ways of phrasing this so as not
> > to confuse google is appreciated.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@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-us...@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: Create new entry on first save of different model

2010-12-09 Thread Ilian Iliev
Hi,

you can overload the save method of Model1 in a way
that it checks type and if it is machine, create two record in Model2.

-- 
eng. Ilian Iliev
Web Software Developer

Mobile: +359 88 66 08 400
Website: ilian.i-n-i.org

On Thu, Dec 9, 2010 at 11:21 PM, Nick  wrote:

> I am working on a project in which I need to evaluate a field in one
> model and based on its values add entries to another model. I don't
> quite now how to succinctly put that into words which is why searching
> for a solution has been so annoying.
>
> Here is my example
>
> Type_Choices = (
>('Person', 'Person'),
>('Machine', 'Machine'),
>)
>
> class Model1(models.Model):
>type = models.CharField(max_length=100, choices=Type_Choices)
>name = models.CharField(max_length=100)
>
> class Model2(models.Model):
>person_job = models.CharField()
>machine_job = models.CharField()
>
>
> what I'd like to do is evaluate type on Model 1 when and entry is
> first created and then if it evaluates to Machine create two new
> entries in Model2. One for  machine_job = primary and one for
> machine_job = secondary. I only want this to fire on the initial save
> of the Model1 object.
>
> Any help with actual code examples or ways of phrasing this so as not
> to confuse google is appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Problems installing south as part of django-cms

2010-12-09 Thread Ilian Iliev
Hi,

the problem look to be that cms is not in your python path.
It should work without hard copying it in other directory.
Are you able to import this middleware from the python interpeter?
If not check your python path.

On Thu, Dec 9, 2010 at 11:25 PM, wilbur  wrote:

> Hello and thank you,
>
> Removing south worked fine. I initially had problems loading
> middleware classes to settings.py for the following:
>
>#'cms.middleware.page.CurrentPageMiddleware',
>#'cms.middleware.user.CurrentUserMiddleware',
>#'cms.middleware.toolbar.ToolbarMiddleware',
>#'cms.middleware.media.PlaceholderMediaMiddleware',
>
> I subsequently hard copied the cms middleware modules to :
>
> /usr/lib/pymodules/python2.6/django/middleware/cms/middleware
>
> with the following settings.py entries:
>
>'django.middleware.cms.middleware.page.CurrentPageMiddleware',
>'django.middleware.cms.middleware.user.CurrentUserMiddleware',
>'django.middleware.cms.middleware.toolbar.ToolbarMiddleware',
>
> 'django.middleware.cms.middleware.media.PlaceholderMediaMiddleware',
>'django.middleware.cache.FetchFromCacheMiddleware',
>
> But, now I get the error:
>
> CMS Permission system requires
> cms.middleware.user.CurrentUserMiddleware.
> Please put it into your MIDDLEWARE_CLASSES in settings file
>
> I have verified that the paths are correct, and the
> CurrentUserMiddleware class exists in the user module??
>
> Thanks
>
>
>
>
>
> On Dec 9, 1:00 pm, Ilian Iliev  wrote:
> > The simplest solution:
> >
> > remove south from the list of installed application, run
> > ./manage.py syncdb
> > this will create you tables the way thay have to be and everything will
> > be ok.
> > This will not fix your south problem, but will allow you to use django
> cms.
> > If you later fix the south, just run
> > ./manage.py migrate cms --fake
> >
> > to fake all cms migrations currently in the project.
> >
> >
> >
> > On Thu, Dec 9, 2010 at 7:13 PM, wilbur  wrote:
> > > Hello,
> >
> > > I am having a hell of a time getting Django-CMS up and running. I am
> > > using Django 1.1.1, and South 0.7.3 (by way of using easy_install
> > > south systemwide, though my Ubuntu synaptic package manager says
> > > 0.6-1) on Ubuntu 10.04 (Lucid). I am following the CMS tutorial at
> > >http://readthedocs.org/projects/ojii/django-cms/docs/tutorial.html.
> > > When I try to run import south from the manage.py shell, I get the
> > > following error:
> >
> > > There is no South database module
> > > 'south.db.south.db.django.db.backends.postgresql_psycopg2' for your
> > > database. Please either choose a supported database, check for
> > > SOUTH_DATABASE_ADAPTER[S] settings, or remove South from
> > > INSTALLED_APPS.
> >
> > > I have south in the INSTALLED_APPS, and my database in settings.py is:
> >
> > > DATABASE_ENGINE = 'django.db.backends.postgresql_psycopg2'
> >
> > > Any detailed help would be much appreciated,
> >
> > > Bill
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-us...@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.
> >
> > --
> > eng. Ilian Iliev
> > Web Software Developer
> >
> > Mobile: +359 88 66 08 400
> > Website: ilian.i-n-i.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-us...@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.
>
>


-- 
eng. Ilian Iliev
Web Software Developer

Mobile: +359 88 66 08 400
Website: ilian.i-n-i.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-us...@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: Problems installing south as part of django-cms

2010-12-09 Thread wilbur
Hello and thank you,

Removing south worked fine. I initially had problems loading
middleware classes to settings.py for the following:

#'cms.middleware.page.CurrentPageMiddleware',
#'cms.middleware.user.CurrentUserMiddleware',
#'cms.middleware.toolbar.ToolbarMiddleware',
#'cms.middleware.media.PlaceholderMediaMiddleware',

I subsequently hard copied the cms middleware modules to :

/usr/lib/pymodules/python2.6/django/middleware/cms/middleware

with the following settings.py entries:

'django.middleware.cms.middleware.page.CurrentPageMiddleware',
'django.middleware.cms.middleware.user.CurrentUserMiddleware',
'django.middleware.cms.middleware.toolbar.ToolbarMiddleware',
 
'django.middleware.cms.middleware.media.PlaceholderMediaMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',

But, now I get the error:

CMS Permission system requires
cms.middleware.user.CurrentUserMiddleware.
Please put it into your MIDDLEWARE_CLASSES in settings file

I have verified that the paths are correct, and the
CurrentUserMiddleware class exists in the user module??

Thanks





On Dec 9, 1:00 pm, Ilian Iliev  wrote:
> The simplest solution:
>
> remove south from the list of installed application, run
> ./manage.py syncdb
> this will create you tables the way thay have to be and everything will
> be ok.
> This will not fix your south problem, but will allow you to use django cms.
> If you later fix the south, just run
> ./manage.py migrate cms --fake
>
> to fake all cms migrations currently in the project.
>
>
>
> On Thu, Dec 9, 2010 at 7:13 PM, wilbur  wrote:
> > Hello,
>
> > I am having a hell of a time getting Django-CMS up and running. I am
> > using Django 1.1.1, and South 0.7.3 (by way of using easy_install
> > south systemwide, though my Ubuntu synaptic package manager says
> > 0.6-1) on Ubuntu 10.04 (Lucid). I am following the CMS tutorial at
> >http://readthedocs.org/projects/ojii/django-cms/docs/tutorial.html.
> > When I try to run import south from the manage.py shell, I get the
> > following error:
>
> > There is no South database module
> > 'south.db.south.db.django.db.backends.postgresql_psycopg2' for your
> > database. Please either choose a supported database, check for
> > SOUTH_DATABASE_ADAPTER[S] settings, or remove South from
> > INSTALLED_APPS.
>
> > I have south in the INSTALLED_APPS, and my database in settings.py is:
>
> > DATABASE_ENGINE = 'django.db.backends.postgresql_psycopg2'
>
> > Any detailed help would be much appreciated,
>
> > Bill
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@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.
>
> --
> eng. Ilian Iliev
> Web Software Developer
>
> Mobile: +359 88 66 08 400
> Website: ilian.i-n-i.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-us...@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.



Create new entry on first save of different model

2010-12-09 Thread Nick
I am working on a project in which I need to evaluate a field in one
model and based on its values add entries to another model. I don't
quite now how to succinctly put that into words which is why searching
for a solution has been so annoying.

Here is my example

Type_Choices = (
('Person', 'Person'),
('Machine', 'Machine'),
)

class Model1(models.Model):
type = models.CharField(max_length=100, choices=Type_Choices)
name = models.CharField(max_length=100)

class Model2(models.Model):
person_job = models.CharField()
machine_job = models.CharField()


what I'd like to do is evaluate type on Model 1 when and entry is
first created and then if it evaluates to Machine create two new
entries in Model2. One for  machine_job = primary and one for
machine_job = secondary. I only want this to fire on the initial save
of the Model1 object.

Any help with actual code examples or ways of phrasing this so as not
to confuse google is appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Errors in modelForm

2010-12-09 Thread robos85
Where can I find any info about how to customize errors messages in
modelforms? I know how to do it in Form, but have no clue how to make
it in modelForm.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



SQL mystery with INNER JOIN?

2010-12-09 Thread Margie Roginski
I'm diving into the sql that is being generated by django and am
having trouble understanding something.  Could someone give me a
hand?  Say I have a Book class like this:

class Book(models.Model):
   readers = models.ManyToMany('auth.user', blank=True, null=True)

Let's say for a given book object I do this:
   readers = book.readers.count()

When I look at the sql via db.connection.queries, I see this:

  SELECT COUNT(*) FROM auth_user INNER JOIN myapp_book_readers ON
(auth_user.id = myapp_book_readers.user_id) WHERE
myapp_book_readers.book_id` = 15

Why does the sql need to do an INNER JOIN with the auth_user table?
Why isn't the query simly this?

  SELECT COUNT(*) FROM book_readers WHERE book_readers.book_id = 15

Any pointers appreciated, thanks!

Margie

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Queryset from 2 models with second model filtered.

2010-12-09 Thread pbzRPA
Typically I simply want to do a left join but have it as an object in
django rather than a sql raw query.

The queryset would look like.

Select
a.code as 'product_code',
a.description as 'product_description',
b.code as 'customer_code',
b.code as 'customer_description',
ifnull(b.code, a.code) as 'code',
ifnull(b.description, b.description) as 'description'
from
products a
left join customerproduct b on b.product_id = a.id where
b.customer_id = 'X'

I know I could create a view in sql and create a model for that but I
am sure there must be a nicer solution.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Queryset from 2 models with second model filtered.

2010-12-09 Thread pbzRPA
Hi,

I have a tricky one, I don't have an error but rather trying to avoid
many database hits.

I am trying to build a product database which can have different field
values per customer.

So the model would look something like this.

class Customer(models.Model):
name = models.CharField(max_length = 50)

class Product(models.Model):
code = models.CharField(max_length = 32)
description = models.CharField(max_length = 50)

class CustomerProduct(models.Model):
product = models.ForeignKey(Product)
customer = models.ForeignKey(Customer)
code = models.CharField(max_length = 32, null = True, blank =
True)
description = models.CharField(max_length = 50, null = True, blank
= True)

The CustomerProduct will only have an entry if a code or description
is provided for a customer. Now ideally I would like to pull a
queryset for a customer which lists all available products (Product),
but if it finds that a CustomerProduct exists that it returns the
CustomerProduct code and description instead of the Product code and
description.

Even better would be having a queryset filtered by Customer that I
could have as 1 object and call the field values like x.product.code
and x.customerproduct.code.

Just looking for some suggestions.

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-us...@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: Problems installing south as part of django-cms

2010-12-09 Thread Ilian Iliev
The simplest solution:

remove south from the list of installed application, run
./manage.py syncdb
this will create you tables the way thay have to be and everything will
be ok.
This will not fix your south problem, but will allow you to use django cms.
If you later fix the south, just run
./manage.py migrate cms --fake

to fake all cms migrations currently in the project.

On Thu, Dec 9, 2010 at 7:13 PM, wilbur  wrote:

> Hello,
>
> I am having a hell of a time getting Django-CMS up and running. I am
> using Django 1.1.1, and South 0.7.3 (by way of using easy_install
> south systemwide, though my Ubuntu synaptic package manager says
> 0.6-1) on Ubuntu 10.04 (Lucid). I am following the CMS tutorial at
> http://readthedocs.org/projects/ojii/django-cms/docs/tutorial.html.
> When I try to run import south from the manage.py shell, I get the
> following error:
>
> There is no South database module
> 'south.db.south.db.django.db.backends.postgresql_psycopg2' for your
> database. Please either choose a supported database, check for
> SOUTH_DATABASE_ADAPTER[S] settings, or remove South from
> INSTALLED_APPS.
>
> I have south in the INSTALLED_APPS, and my database in settings.py is:
>
> DATABASE_ENGINE = 'django.db.backends.postgresql_psycopg2'
>
> Any detailed help would be much appreciated,
>
> Bill
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
eng. Ilian Iliev
Web Software Developer

Mobile: +359 88 66 08 400
Website: ilian.i-n-i.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-us...@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: can't add via admin, get django template error

2010-12-09 Thread JeffH
I had defined a custom admin class for that model. I commented it out
and went with the default admin class, and got the same error trying
to create a new record. So didn't think it was the admin.

Then I looked at the date fields on that model. Turned out that
specifying a default date as a string was the problem:
  publish_date = models.DateTimeField(default='2039-12-31') # don't!

Even though it works with a standard ModelForm form, ie gets displayed
in the UI properly, is accepted as a valid date by the Form
validation, and gets inserted into the db properly.

I think that the admin should accept such a (properly formed) date
string. Or else the model shouldn't validate.

On Dec 8, 2:20 pm, Wayne Smith  wrote:
> On Wed, Dec 8, 2010 at 10:49 AM, JeffH  wrote:
> > So I'm working along, everything's humming fine. Then I try to add a
> > record via the admin, and get the following:
>
> > TemplateSyntaxError at /admin/expert/expertresponse/add/
> > Caught AttributeError while rendering: 'unicode' object has no
> > attribute 'date'
>
> > [snip]
>
> > Template error
>
> > In template c:\python26\lib\site-packages\django\contrib\admin
> > \templates\admin\includes\fieldset.html, error at line 12
> > Caught AttributeError while rendering: 'unicode' object has no
> > attribute 'date'
> > 2       {% if fieldset.name %}{{ fieldset.name }}{% endif %}
> > 3       {% if fieldset.description %} > class="description">{{ fieldset.description|safe }}{% endif %}
> > 4       {% for line in fieldset %}
> > 5       
> > 6       {{ line.errors }}
> > 7       {% for field in line %}
> > 8        > endif %}>
> > 9       {% if field.is_checkbox %}
> > 10      {{ field.field }}{{ field.label_tag }}
> > 11      {% else %}
> > 12      {{ field.label_tag }}{{ field.field }}
>
> > I can add records via a ModelForm without problem, it just doesn't
> > work in the admin.
>
> > As you probably surmised from the error, the admin is expecting a field
>
> attribute of type date on your  model object (line?).  Anyway, what is
> getting passed is an Unicode object, which obviously does not have the
> attribute (field) it is looking for.
>
> I would guess that the problem lies somewhere in your admin file
> (admin.py).  What are the contents of it?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 session InvalidOperation

2010-12-09 Thread Dan Fairs
Hi there,

> I'm fairly new to Django, and I'm trying to move an existing Django
> application to a new server. The old server is running Django 1.0.2
> and Python 2.5.4. The closest I could come on my new server (to start)
> is Django 1.0.4 and Python 2.5.5.
> 
> Anyway, I get an admin login screen, but when I try to log in, I get
> an error:
> 
> Exception Type:   InvalidOperation
> Exception Value:  Invalid literal for Decimal: '2010-12-22 17:36:30'
> Exception Location:   build/bdist.linux-i686/egg/MySQLdb/connections.py
> in defaulterrorhandler, line 35
> 
> If I'm reading the error page right, it looks like it's happening in
> db/models/query.py, somewhere around here:
> 
> 316. clone = self.filter(*args, **kwargs)
> 317. num = len(clone) ...
> 
> Any advice on how to get past this?

You'll need to post a longer stack trace, just a fragment isn't much use. 
Switch to the copy-and-paste view so you can copy-and-paste it :)

Cheers,
Dan
--
Dan Fairs | dan.fa...@gmail.com | www.fezconsulting.com


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Really annoying problem, First App part 1 related

2010-12-09 Thread Joe
Aaaah cheers, I knew there was something fundamentally wrong. Got it
working now.

On Dec 9, 6:58 pm, Martin Melin  wrote:
> On Thu, Dec 9, 2010 at 7:03 PM, Joe  wrote:
> > Ok, so when I do exactly as the tutorial says, I get hella errors. I
> > change directory to where I want to store my project which goes fine,
> > then:
>  django-admin.py startproject mysite
> > SyntaxError: invalid syntax
>
> > with 'startproject' highlighted. The django-admin.py file is in the
> > directory I changed to.
>
> django-admin.py is a program that should be run in your OS shell, not
> in a Python interpreter which it looks like you're trying to do here.
>
> Regards
> Martin Melin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Really annoying problem, First App part 1 related

2010-12-09 Thread Martin Melin
On Thu, Dec 9, 2010 at 7:03 PM, Joe  wrote:
> Ok, so when I do exactly as the tutorial says, I get hella errors. I
> change directory to where I want to store my project which goes fine,
> then:
 django-admin.py startproject mysite
> SyntaxError: invalid syntax
>
> with 'startproject' highlighted. The django-admin.py file is in the
> directory I changed to.

django-admin.py is a program that should be run in your OS shell, not
in a Python interpreter which it looks like you're trying to do here.

Regards
Martin Melin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



user authentication

2010-12-09 Thread Paul
Long story short have several django projects running

I log in ok and the projects run fine using the admin interface.

However :

I have added users and given them access to only certian applications
on the django site using the admin interface, however when i log in
with out supervisor access checked all is blank aka no applications
etc  and a message that says You have no permission to access anything
on this site.

Is there a different login link for normal users to use? (aka no /
admin but something else)

Is there setup required (which is probable) - I can not find any
documentation on this directly.

I consider myself pretty clever but i am stumpped.

Would like to use the admin site to manage how user login and what
they get access to


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Really annoying problem, First App part 1 related

2010-12-09 Thread Joe
Ok, so when I do exactly as the tutorial says, I get hella errors. I
change directory to where I want to store my project which goes fine,
then:
>>> django-admin.py startproject mysite
SyntaxError: invalid syntax

with 'startproject' highlighted. The django-admin.py file is in the
directory I changed to.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: CSRF missing token

2010-12-09 Thread martvefun
Hi

Thank you it works well


On 09-12-10 09:15, Ilian Iliev wrote:
> Hi,
>
> you have to include the request context to use CSRF token.
>
> from django.template import RequestContext
>
> return render_to_response('index.html', locals(), context_instance =
> RequestContext(request))
>
> Greeting,
> Ilian Iliev
>
> On Thu, Dec 9, 2010 at 2:08 AM, martvefun  > wrote:
>
> Hello,
>
> I've a login form which give me an CSRF error.
> In the documentation, I read that I needed to have in my code :
>
> # views.py
> ...
>csrf_token = {}
>csrf_token.update(csrf(request))
>return render_to_response('index.html', locals())
>
> # index.html
> ...
>
> {% csrf_token %}
>
> But I've an error that the two tokens are different
> I guess the problem is in the generation of the token :
>
> 
> name='csrfmiddlewaretoken' value='{'csrf_token':
> }' />
>
>
> It should use value="{'csrf_ instead of value='{'csrf._..
>
> Any idea how to fix ?
>
> 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.
>
>
>
>
> -- 
> eng. Ilian Iliev
> Web Software Developer
>
> Mobile: +359 88 66 08 400
> Website: ilian.i-n-i.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-us...@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-us...@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.



Pre-filled user info in Django Comments?

2010-12-09 Thread Paolo
Hi,

The site I'm building uses the standard user management framework and
the standard comments framework.

What I'd like to see happen is the comments form rendered with the
user's name and email address pre-filled if they are already signed in
(or have the fields hidden entirely!).

Easy enough?

Cheers,

Paul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Problems installing south as part of django-cms

2010-12-09 Thread wilbur
Hello,

I am having a hell of a time getting Django-CMS up and running. I am
using Django 1.1.1, and South 0.7.3 (by way of using easy_install
south systemwide, though my Ubuntu synaptic package manager says
0.6-1) on Ubuntu 10.04 (Lucid). I am following the CMS tutorial at
http://readthedocs.org/projects/ojii/django-cms/docs/tutorial.html.
When I try to run import south from the manage.py shell, I get the
following error:

There is no South database module
'south.db.south.db.django.db.backends.postgresql_psycopg2' for your
database. Please either choose a supported database, check for
SOUTH_DATABASE_ADAPTER[S] settings, or remove South from
INSTALLED_APPS.

I have south in the INSTALLED_APPS, and my database in settings.py is:

DATABASE_ENGINE = 'django.db.backends.postgresql_psycopg2'

Any detailed help would be much appreciated,

Bill

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Returning value directly to another function

2010-12-09 Thread Ilian Iliev
Hi

what exactly is the problem with the if check?
Why is it so bad?

On Thu, Dec 9, 2010 at 4:21 PM, Quetzacotl  wrote:

> Hello, this is rather python problem, but maybe You can help. What i
> want to do is to return value in another function calling from other
> function.
>
> It doesnt mean i want this:
>
> def Func():
> return 1
>
> def Func2():
> return Func()
>
> I want function Func to return 1 directly in Func2 as it is Func2
> returning it.
>
> I have this problem because view function has to return response
> object and my function that adds element to database (comments)
> returns HttpResponseRedirect or context dict with form that has
> errors.
> If it returns redirect then i want view function to return it, if it
> return context then i dont want to return it but rather give it to
> render_to_response.
>
> It comes to this:
>
> def Add():
> #form valid, add to db
> return { 'redirect': HttpResponseRedirect('url'), }
>
> #form not valid
> return { 'form': form, 'redirect': 0, }
>
> def View(request):
> add = Add()
> if add['redirect']!=0:
>  return add['redirect']
>
> return render_to_response(template,add)
>
> Thing i dont want here is if statement checking if there is redirect,
> so i want within function Add return HttpResponseRedirect as it is
> View function.
>
> I dont know if this is possible.
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
eng. Ilian Iliev
Web Software Developer

Mobile: +359 88 66 08 400
Website: ilian.i-n-i.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-us...@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 use django-command-extentions dumpscript?

2010-12-09 Thread mongoose
I think I may have misunderstood. Does a dumpscript save all your
CURRENT data into a script file which you can later use to restore
your data??

On Dec 8, 9:07 pm, fei  wrote:
> Have you successfully installed django-extensions into python?
>
> Here are the detailed instructions
>
> http://code.google.com/p/django-command-extensions/wiki/InstallationI...
>
> Fei
>
> On Dec 8, 6:30 am, mongoose  wrote:
>
> > Hi all,
>
> > I'm trying out django-command-extensions I want to use the dumpscript
> > command but I don't understand what I'm supposed to do to set it up.
>
> > How to use django-command-extentions dumpscript?
>
> > 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-us...@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 use django-command-extentions dumpscript?

2010-12-09 Thread mongoose
Hi There,

Yes I have installed it correctly but not sure how to use the
dumpscript functionality.
I ran $ ./manage.py dumpscript appname > scripts/testdata.py and it
generated me a blank script. Now what?

On Dec 8, 9:07 pm, fei  wrote:
> Have you successfully installed django-extensions into python?
>
> Here are the detailed instructions
>
> http://code.google.com/p/django-command-extensions/wiki/InstallationI...
>
> Fei
>
> On Dec 8, 6:30 am, mongoose  wrote:
>
> > Hi all,
>
> > I'm trying out django-command-extensions I want to use the dumpscript
> > command but I don't understand what I'm supposed to do to set it up.
>
> > How to use django-command-extentions dumpscript?
>
> > 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-us...@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.



Returning value directly to another function

2010-12-09 Thread Quetzacotl
Hello, this is rather python problem, but maybe You can help. What i
want to do is to return value in another function calling from other
function.

It doesnt mean i want this:

def Func():
 return 1

def Func2():
 return Func()

I want function Func to return 1 directly in Func2 as it is Func2
returning it.

I have this problem because view function has to return response
object and my function that adds element to database (comments)
returns HttpResponseRedirect or context dict with form that has
errors.
If it returns redirect then i want view function to return it, if it
return context then i dont want to return it but rather give it to
render_to_response.

It comes to this:

def Add():
 #form valid, add to db
 return { 'redirect': HttpResponseRedirect('url'), }

 #form not valid
 return { 'form': form, 'redirect': 0, }

def View(request):
 add = Add()
 if add['redirect']!=0:
  return add['redirect']

 return render_to_response(template,add)

Thing i dont want here is if statement checking if there is redirect,
so i want within function Add return HttpResponseRedirect as it is
View function.

I dont know if this is possible.





-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File upload fail on live server

2010-12-09 Thread Sithembewena Lloyd Dube
Thanks Kenneth. I tried your recommendation, the file is not uploaded at
all. I'm stumped by this, as
the folder is writable by apache. I will post on here when I do implement a
fix.

On Thu, Dec 9, 2010 at 1:46 PM, Kenneth Gonsalves  wrote:

> On Thu, 2010-12-09 at 13:42 +0200, Sithembewena Lloyd Dube wrote:
> > Thanks Kenneth, am trying to figure out how to set the MEDIA_ROOT to
> > the
> > folder outside the project.
>
> /home/lloyd/smedia/ and make it writable by the webserver
> --
> regards
> Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

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



Re: Help for for loop

2010-12-09 Thread Tom Evans
Ahh thanks Bruno, that gave the correct solution:

>>> l
['pos 0', 'pos 1', 'pos 2', 'pos 3']
>>> l[1::2]
['pos 1', 'pos 3']

My slice-fu is clearly weak.

Cheers

Tom

On Thu, Dec 9, 2010 at 12:03 PM, bruno desthuilliers
 wrote:
>
>
> On 9 déc, 12:24, Tom Evans  wrote:
>> Hmm, those are the values that are odd, he wanted the values from odd
>> indices
>
> Well spotted ;)
>
> There's a builtin "slice" filter that should have done the trick but I
> just couldn't manage to make it work with a for loop :-/
>
> The only solution I could come with that does not require custom
> filters or whatever is using the cycle tag (http://
> docs.djangoproject.com/en/1.2/ref/templates/builtins/#cycle):
>
> {% for item in list %}
>  {% cycle "even", "odd"  as oddeven %} {# assuming standard 0-based
> indexing #}
>  {% if oddeven == "odd" %}
>    item {{ item }} is at odd index {{ forloop.counter }}
>  {% endif %}
> {% endfor %}
>
>
> NB : not tested...
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help for for loop

2010-12-09 Thread Phani Chand
Thanx for help.
I solved the problem using divisibleby

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



Re: Help for for loop

2010-12-09 Thread bruno desthuilliers


On 9 déc, 12:24, Tom Evans  wrote:
> Hmm, those are the values that are odd, he wanted the values from odd
> indices

Well spotted ;)

There's a builtin "slice" filter that should have done the trick but I
just couldn't manage to make it work with a for loop :-/

The only solution I could come with that does not require custom
filters or whatever is using the cycle tag (http://
docs.djangoproject.com/en/1.2/ref/templates/builtins/#cycle):

{% for item in list %}
  {% cycle "even", "odd"  as oddeven %} {# assuming standard 0-based
indexing #}
  {% if oddeven == "odd" %}
item {{ item }} is at odd index {{ forloop.counter }}
  {% endif %}
{% endfor %}


NB : not tested...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File upload fail on live server

2010-12-09 Thread Kenneth Gonsalves
On Thu, 2010-12-09 at 13:42 +0200, Sithembewena Lloyd Dube wrote:
> Thanks Kenneth, am trying to figure out how to set the MEDIA_ROOT to
> the
> folder outside the project. 

/home/lloyd/smedia/ and make it writable by the webserver 
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File upload fail on live server

2010-12-09 Thread Sithembewena Lloyd Dube
Thanks Kenneth, am trying to figure out how to set the MEDIA_ROOT to the
folder outside the project.



On Thu, Dec 9, 2010 at 12:58 PM, Kenneth Gonsalves wrote:

> On Thu, 2010-12-09 at 12:47 +0200, Sithembewena Lloyd Dube wrote:
> > Is it proper/ feasible to save media to and serve it from, a media
> > folder
> > outside of the project?
>
> it is proper - as this will not come under version control whereas the
> project will
> --
> regards
> Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

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



Re: Help for for loop

2010-12-09 Thread Tom Evans
Because that looks at the values of the array and returns the items
which have a value that is divisible by two, not the position of the
value within the array. It is simpler to comprehend if you don't put
numbers in the list:

>>> l = [ 'pos 0', 'pos 1', 'pos 2', 'pos 3' ]
>>> filter(lambda x: not x%2, l)
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1, in 
TypeError: not all arguments converted during string formatting
>>> [ val for val, i in itertools.izip(l, itertools.count()) if i % 2 ]
['pos 1', 'pos 3']

What the OP originally asked for was for items in the i'th position in
a list, where i is odd. Your solutions all ignore the position, and
only look at the value.

On Thu, Dec 9, 2010 at 11:27 AM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> I see no need to get itertools involved ;) Why not just use this:
>
> filter(lambda x: not x%2, a)
>
>
> On 09/12/2010 11:24, Tom Evans wrote:
>>
>> Hmm, those are the values that are odd, he wanted the values from odd
>> indices, eg:
>>
> a=[2,3,4,5,6,7]
> filter(lambda x: x%2, a)
>>
>> [3, 5, 7]
>
> [ val for val, i in itertools.izip(a, itertools.count()) if not i % 2 ]
>>
>> [2, 4, 6]
>>
>> That could probably be written a bit nicer..
>>
>> On Thu, Dec 9, 2010 at 10:44 AM, Cal Leeming [Simplicity Media Ltd]
>>   wrote:
>>
>> mylist = [1,2,3,4,5,6,7,8]
>> filter(lambda x: x%2, mylist)
>>>
>>> [1, 3, 5, 7]
>>> This what you need?
>>>
>>> On 09/12/2010 10:34, Phani Chand wrote:

 i am passing though a list{1,2,3,4} but i want only the numbers with odd
 index in template written in html --
 You received this message because you are subscribed to the Google
 Groups
 "Django users" group.
 To post to this group, send email to django-us...@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-us...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help for for loop

2010-12-09 Thread Cal Leeming [Simplicity Media Ltd]
Can't you use the % operator within if statements in templates? I was 
almost sure I'd done this before :|


On 09/12/2010 11:27, bruno desthuilliers wrote:

On 9 déc, 12:18, Phani Chand  wrote:

Can i use filter(lambda x: x%2, mylist) directly in my html page

s/html page/template/

And no, you cannot use Python code in a template.
You can either
1/ filter the list in the view
2/ use the builtin "divisibleby" filter (http://docs.djangoproject.com/
en/1.2/ref/templates/builtins/#divisibleby)
3/ write your own "odds" and "evens" filters (http://
docs.djangoproject.com/en/1.2/howto/custom-template-tags/)

HTH



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



Re: Help for for loop

2010-12-09 Thread Cal Leeming [Simplicity Media Ltd]

I see no need to get itertools involved ;) Why not just use this:

filter(lambda x: not x%2, a)


On 09/12/2010 11:24, Tom Evans wrote:

Hmm, those are the values that are odd, he wanted the values from odd
indices, eg:


a=[2,3,4,5,6,7]
filter(lambda x: x%2, a)

[3, 5, 7]

[ val for val, i in itertools.izip(a, itertools.count()) if not i % 2 ]

[2, 4, 6]

That could probably be written a bit nicer..

On Thu, Dec 9, 2010 at 10:44 AM, Cal Leeming [Simplicity Media Ltd]
  wrote:

mylist = [1,2,3,4,5,6,7,8]
filter(lambda x: x%2, mylist)

[1, 3, 5, 7]
This what you need?

On 09/12/2010 10:34, Phani Chand wrote:

i am passing though a list{1,2,3,4} but i want only the numbers with odd
index in template written in html --
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@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-us...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help for for loop

2010-12-09 Thread bruno desthuilliers
On 9 déc, 12:18, Phani Chand  wrote:
> Can i use filter(lambda x: x%2, mylist) directly in my html page

s/html page/template/

And no, you cannot use Python code in a template.
You can either
1/ filter the list in the view
2/ use the builtin "divisibleby" filter (http://docs.djangoproject.com/
en/1.2/ref/templates/builtins/#divisibleby)
3/ write your own "odds" and "evens" filters (http://
docs.djangoproject.com/en/1.2/howto/custom-template-tags/)

HTH

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



Re: Help for for loop

2010-12-09 Thread Tom Evans
Hmm, those are the values that are odd, he wanted the values from odd
indices, eg:

>>> a=[2,3,4,5,6,7]
>>> filter(lambda x: x%2, a)
[3, 5, 7]
>>> [ val for val, i in itertools.izip(a, itertools.count()) if not i % 2 ]
[2, 4, 6]

That could probably be written a bit nicer..

On Thu, Dec 9, 2010 at 10:44 AM, Cal Leeming [Simplicity Media Ltd]
 wrote:
 mylist = [1,2,3,4,5,6,7,8]
 filter(lambda x: x%2, mylist)
> [1, 3, 5, 7]

>
> This what you need?
>
> On 09/12/2010 10:34, Phani Chand wrote:
>>
>> i am passing though a list{1,2,3,4} but i want only the numbers with odd
>> index in template written in html --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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-us...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help for for loop

2010-12-09 Thread Cal Leeming [Simplicity Media Ltd]

Uh, you *might* be able to use:

{% for x in mylist %}
{% if x % 2 %}
yay: {{x}}
{% else %}
nay: {{x}}
{% endif %}
{% endfor %}

On 09/12/2010 11:18, Phani Chand wrote:

Can i use  filter(lambda x: x%2, mylist) directly in my html page --
You received this message because you are subscribed to the Google 
Groups "Django users" group.

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



Re: Help for for loop

2010-12-09 Thread Phani Chand
Can i use filter(lambda x: x%2, mylist) directly in my html page

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File upload fail on live server

2010-12-09 Thread Kenneth Gonsalves
On Thu, 2010-12-09 at 12:47 +0200, Sithembewena Lloyd Dube wrote:
> Is it proper/ feasible to save media to and serve it from, a media
> folder
> outside of the project? 

it is proper - as this will not come under version control whereas the
project will
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: CSRF missing token

2010-12-09 Thread Ilian Iliev
Hi,

you have to include the request context to use CSRF token.

from django.template import RequestContext

return render_to_response('index.html', locals(), context_instance =
RequestContext(request))

Greeting,
Ilian Iliev

On Thu, Dec 9, 2010 at 2:08 AM, martvefun  wrote:

> Hello,
>
> I've a login form which give me an CSRF error.
> In the documentation, I read that I needed to have in my code :
>
> # views.py
> ...
>csrf_token = {}
>csrf_token.update(csrf(request))
>return render_to_response('index.html', locals())
>
> # index.html
> ...
>
> {% csrf_token %}
>
> But I've an error that the two tokens are different
> I guess the problem is in the generation of the token :
>
> 
> name='csrfmiddlewaretoken' value='{'csrf_token':
> }' />
>
>
> It should use value="{'csrf_ instead of value='{'csrf._..
>
> Any idea how to fix ?
>
> 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-us...@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.
>
>


-- 
eng. Ilian Iliev
Web Software Developer

Mobile: +359 88 66 08 400
Website: ilian.i-n-i.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-us...@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: File upload fail on live server

2010-12-09 Thread Sithembewena Lloyd Dube
Issue isolated. The uploads are going into the MEDIA_ROOT, which is the
'media' folder in my app.

The MEDIA_URL is pointing to a location outside of the project.

Is it proper/ feasible to save media to and serve it from, a media folder
outside of the project?

On Thu, Dec 9, 2010 at 12:01 PM, Sithembewena Lloyd Dube
wrote:

> Hi Kenneth,
>
> The FileField is optional indeed. Surely it should be populated where a
> file is provided though?
>
> Update: turns out I have not installed the PIL on my staging server. Am
> doing so now and retesting. this may well turn out to be a PEBKAC :)
>
> Thanks.
>
>
> On Thu, Dec 9, 2010 at 11:46 AM, Kenneth Gonsalves wrote:
>
>> On Thu, 2010-12-09 at 15:11 +0530, Kenneth Gonsalves wrote:
>> > On Thu, 2010-12-09 at 10:20 +0200, Sithembewena Lloyd Dube wrote:
>> > > However, my live application fails to upload the file (ie the
>> > > FileField is
>> > > empty in the database after uploading, and the file is not
>> > uploaded).
>> >
>> > path problem or permission problem
>>
>> I am assuming the filefield is optional
>> --
>> regards
>> Kenneth Gonsalves
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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.
>>
>>
>
>
> --
> Regards,
> Sithembewena Lloyd Dube
>



-- 
Regards,
Sithembewena Lloyd Dube

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



Re: Help for for loop

2010-12-09 Thread Cal Leeming [Simplicity Media Ltd]

>>> mylist = [1,2,3,4,5,6,7,8]
>>> filter(lambda x: x%2, mylist)
[1, 3, 5, 7]
>>>

This what you need?

On 09/12/2010 10:34, Phani Chand wrote:
i am passing though a list{1,2,3,4} but i want only the numbers with 
odd index in template written in html --
You received this message because you are subscribed to the Google 
Groups "Django users" group.

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



Help for for loop

2010-12-09 Thread Phani Chand
i am passing though a list{1,2,3,4} but i want only the numbers with
odd index in template written in html

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File upload fail on live server

2010-12-09 Thread Sithembewena Lloyd Dube
Hi Kenneth,

The FileField is optional indeed. Surely it should be populated where a file
is provided though?

Update: turns out I have not installed the PIL on my staging server. Am
doing so now and retesting. this may well turn out to be a PEBKAC :)

Thanks.

On Thu, Dec 9, 2010 at 11:46 AM, Kenneth Gonsalves wrote:

> On Thu, 2010-12-09 at 15:11 +0530, Kenneth Gonsalves wrote:
> > On Thu, 2010-12-09 at 10:20 +0200, Sithembewena Lloyd Dube wrote:
> > > However, my live application fails to upload the file (ie the
> > > FileField is
> > > empty in the database after uploading, and the file is not
> > uploaded).
> >
> > path problem or permission problem
>
> I am assuming the filefield is optional
> --
> regards
> Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File upload fail on live server

2010-12-09 Thread Kenneth Gonsalves
On Thu, 2010-12-09 at 15:11 +0530, Kenneth Gonsalves wrote:
> On Thu, 2010-12-09 at 10:20 +0200, Sithembewena Lloyd Dube wrote:
> > However, my live application fails to upload the file (ie the
> > FileField is
> > empty in the database after uploading, and the file is not
> uploaded). 
> 
> path problem or permission problem 

I am assuming the filefield is optional
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File upload fail on live server

2010-12-09 Thread Kenneth Gonsalves
On Thu, 2010-12-09 at 10:20 +0200, Sithembewena Lloyd Dube wrote:
> However, my live application fails to upload the file (ie the
> FileField is
> empty in the database after uploading, and the file is not uploaded). 

path problem or permission problem
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File upload fail on live server

2010-12-09 Thread Sithembewena Lloyd Dube
PS: I also a have a separate model which is using an ImageField subclass to
upload an avatar. On my development machine, I can edit a record and change
the thumbnail without issues. On the live server, nice the thumbnail is
saved it cannot be changed.

Ideas?

On Thu, Dec 9, 2010 at 10:20 AM, Sithembewena Lloyd Dube
wrote:

> Hi guys,
>
> I have a form where I use a FileField to upload a file to the server and
> this works fine on my local machine.
>
> However, my live application fails to upload the file (ie the FileField is
> empty in the database after uploading, and the file is not uploaded).
>
> I know this is a pot shot, but would anybody have an idea what is going on?
>
>
>
> --
> Regards,
> Sithembewena Lloyd Dube
>



-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



File upload fail on live server

2010-12-09 Thread Sithembewena Lloyd Dube
Hi guys,

I have a form where I use a FileField to upload a file to the server and
this works fine on my local machine.

However, my live application fails to upload the file (ie the FileField is
empty in the database after uploading, and the file is not uploaded).

I know this is a pot shot, but would anybody have an idea what is going on?



-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.