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

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

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

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

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 =

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

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():

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,

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)

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: > *

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

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

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

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}\

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

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

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',

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

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

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

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

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 =

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

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.

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

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

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',

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',

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

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

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',

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 =

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

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

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

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

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

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

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

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,

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

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

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.

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

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

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

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,

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

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

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

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

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

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:

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

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

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

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

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

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

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

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:

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,

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

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

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,

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

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

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,

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