Re: set up database engine

2010-04-08 Thread Thierry Chich
Some of the lines you are writing are not intended to be written in the Shell monitor. You must write them in the file settings.py ! You have no alert message because variable='foo' is a correct syntax in a bourne Shell, but it is doing absolutely nothing. Le 9 avr. 2010 à 05:58, yangya

Re: /i18n/setlang/ broken?

2010-04-08 Thread Steve Holden
[facepalm] is much quicker and far less painful; -) On Apr 8, 2010 4:25 PM, "chr" wrote: hi rolando, yep, that fixed it. stupid me. i'll spend the next few hours hitting my head against the desk. thank you so much. cheers, chr On Apr 8, 5:44 pm, Rolando Espinoza La Fuente wrote: > On Thu, A

Re: set up database engine

2010-04-08 Thread Steve Holden
So as an experienced Googlenaught (TM) I was a little surprised to find that the first hit for "django-users sqlite howto" was not terribly helpful for a beginner. The second hit (eventually) said """Now, edit settings.py. It's a normal Python module with module-level variables representing Djang

Re: set up database engine

2010-04-08 Thread Steve Holden
Oh, I see it wasn't just a Google failure. Thierry gave you the correct answer, but omitted to mention (or we omitted to notice) that those lines go in your settings.py file. No use typing them on the command line. .. Regards Steve On Apr 9, 2010 12:26 AM, "Steve Holden" wrote: This might just

Re: set up database engine

2010-04-08 Thread Steve Holden
This might just have been a spelling issue. http://docs.djangoproject.com/en/dev/ref/databases/#sqlite-notes Regards Steve On Apr 8, 2010 12:18 AM, "yangyang" wrote: how exactly set up the database engine as SQLight? The tutorial doesn't seem to tell us... Thanks! -- You received this messag

Re: set up database engine

2010-04-08 Thread yangyang
Hi Thierry, Thanks for the reply. I understand what SQLight is but I don't know how to write the code in my Mac shell... This is what I wrote: yang-wangs-computer:~/applications/mysite yangwang$ database_engine='sqlite3' yang-wangs-computer:~/applications/mysite yangwang$ database_name='trydb' y

How to delete objects whose id is stored in a session when it ends?

2010-04-08 Thread laser_cg
Hello everybody! I am working with sessions with the database backend in an e-commerce shop. I store the cart ID, the number of items in the cart and the total prize in the session. But actually have two problems. 1. I set the SESSION_EXPIRE_AT_BROWSER_CLOSE = True, but Django does not delete the

Re: dumpdata doesn't seem to respect database routers

2010-04-08 Thread Russell Keith-Magee
On Fri, Apr 9, 2010 at 2:34 AM, wizard_2 wrote: > Hi everyone, > Mange dumpdata seems to be ignoring my database router and failing on > a model thats in a different db. > > I have two databases, default (mysql db named knothedashboard) and > bluecherry (mssql database named dataKNOT). Here's my r

MySQLdb setup on snow leopard help

2010-04-08 Thread CG
I have successfully setup django, although I am not sure how I did it. Now I am trying to setup MySQLdb but keep getting the error File "setup.py", line 5, in from setuptools import setup, Extension ImportError: No module named setuptools -- You received this message because you are subs

Re: django.forms.widgets.Select error

2010-04-08 Thread Tim Shaffer
Choices should be a list/tuple of lists/tuples in the form of (value,display). So this: choices = (('M','Male'),('F','Female'),) Would give you this: Male Female -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send emai

Re: Dynamic Inline fileds

2010-04-08 Thread Asim Yuksel
Hi Asim :) Here is the solution step by step: 1) Go to Lib\site-packages\django\contrib\admin\media\js directory and copy the following js files to js folder jquery-1.4.2 from jquery website dynamic_inlines_with_sort.js from http://www.djangosnippets.org/snippets/1489/ and create th

Re: Considering Django: How simple is customising django-admin?

2010-04-08 Thread Jon
1. Inlines http://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects 2. Form media http://docs.djangoproject.com/en/dev/topics/forms/media/ 3. Your example does not require custom template overrides for the admin HTML, it is possible to simply include a function from your

django.forms.widgets.Select error

2010-04-08 Thread I. Laughlin
Hello, I'm running into something that I don't fully understand when I do the following: >from django.forms.widgets import Select >s = Select(choices=[1,2,3]) >s.render("foo",None) Traceback (most recent call last): File "", line 1, in File "/usr/lib/pymodules/python2.6/django/forms/wi dgets.

Re: How to make pagination with haystack

2010-04-08 Thread Ray McBride
page is passed in by the view http://github.com/toastdriven/django-haystack/blob/master/haystack/views.py django pagination requires page_obj http://code.google.com/p/django-pagination/source/browse/trunk/pagination/templates/pagination/pagination.html best wishes Ray -- http://raymcbride.com

Re: Setting up Django on snow leopard

2010-04-08 Thread CG
I have successfully setup django, although I am not sure how I did it. Now I am trying to setup MySQLdb but keep getting the error File "setup.py", line 5, in from setuptools import setup, Extension ImportError: No module named setuptools On Apr 8, 12:45 pm, CG wrote: > Nothing happens

Re: Considering Django: How simple is customising django-admin?

2010-04-08 Thread Brian Neal
On Apr 8, 5:15 am, UnclaimedBaggage wrote: > Hi folks, > [..] > Any > suggestions on the following would be very appreciated: > > #1.) For usability's sake, I'd like to have foreign key models > embedded in the same admin form as the model they're referencing. For > example, if there's a "products

Re: /i18n/setlang/ broken?

2010-04-08 Thread chr
hi rolando, yep, that fixed it. stupid me. i'll spend the next few hours hitting my head against the desk. thank you so much. cheers, chr On Apr 8, 5:44 pm, Rolando Espinoza La Fuente wrote: > On Thu, Apr 8, 2010 at 6:21 AM, chr wrote: > > btw, here's the minimal-app:http://github.com/statesof

Re: How to make pagination with haystack

2010-04-08 Thread Ariel
That variables in the piece of code that you have given are automatically passed by the faceted view of the haystack to the search.html template ??? On Thu, Apr 8, 2010 at 10:43 AM, Ray McBride wrote: > Try > > {% with page as page_obj %} > {% paginate %} > {% endwith %} > > Ray > > On Apr 8, 2:

Re: Middleware process_response function and dynamic image rendering

2010-04-08 Thread hrdber
I figured out the issue: I needed to create a *new* instance of an HttpResponse instead of just modifying the original. Old way (bad): def process_response(request, response): response.content = "whatever" return response New way (good!): def process_response(request, resp

dumpdata doesn't seem to respect database routers

2010-04-08 Thread wizard_2
Hi everyone, Mange dumpdata seems to be ignoring my database router and failing on a model thats in a different db. I have two databases, default (mysql db named knothedashboard) and bluecherry (mssql database named dataKNOT). Here's my router. (Should I be using dpaste.com?) def db_for_read(

Displaying a custom field (PickledObjectField) in the admin

2010-04-08 Thread John DeRosa
Hello Djangonauts, I'm doing something wrong, but I just can't see it! My problem is that a custom model field isn't being displayed in the Admin interface. I'm running OS X 10.6.3, Python 2.6, and Django 1.1.1. I installed django-picklefield 0.1.5 from PyPi, and I'm trying to use it in a data

Middleware process_response function and dynamic image rendering

2010-04-08 Thread hrdber
I am trying to dynamically replace certain text blocks (MathML to be specific) with images. The images have already been rendered and stored in the database. These images are rendered by calling a view. This simple filtering procedure seemed like the perfect use of a custom middleware class. I hav

Re: Inline for model causes problem during save

2010-04-08 Thread onorua
I'm using 1.1.1 On the development server on my laptop - it doesn't happen, on production - happen every time. How can I debug why this happen? On 8 апр, 20:35, Nuno Maltez wrote: > If I understand correctly, you can't create a User without defining a > SoldService at the same time? > Can't repro

Re: Error when following the tutorial

2010-04-08 Thread johan sommerfeld
Sometimes removing all .pyc files helps. /J On Wed, Apr 7, 2010 at 11:39 PM, Shawn Milochik wrote: > Try to do ./manage.py shell and import your poll model. > > Once you can do that, you will have figured out the solution to this > problem as a by-product. > I don't expect it to work first try,

Dynamic Inline fileds

2010-04-08 Thread Asim Yuksel
How can I add dynamic inline fields? I want to use the extra=1 and I want to have a plus sign which will add more dynamic fields so the extra field will increase -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email t

Re: Setting up Django on snow leopard

2010-04-08 Thread CG
Nothing happens, I just get a > On Apr 8, 12:39 pm, Tim Shaffer wrote: > Very strange. What happens if you open a new Terminal window and run > the following? > > python -c "import sys; print sys.path" -- You received this message because you are subscribed to the Google Groups "Django users"

Re: Considering Django: How simple is customising django-admin?

2010-04-08 Thread johan sommerfeld
#1 This can be done. One to Many and foreign keys shows up in django admin as multiple choice or select box. You can also make foreign key related models inline meaning that you can add one or possibly multiple entries to another model and automatically reference them to the entry you are about to

Re: Setting up Django on snow leopard

2010-04-08 Thread Tim Shaffer
Very strange. What happens if you open a new Terminal window and run the following? python -c "import sys; print sys.path" -- 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 un

Re: Inline for model causes problem during save

2010-04-08 Thread Nuno Maltez
If I understand correctly, you can't create a User without defining a SoldService at the same time? Can't reproduce this behaviour. Which version of Django are you using? Nuno 2010/4/7 onorua : > Hello colleagues, > > I have the models.py: > class User(models.Model): >    LastName = models.CharFi

Re: Setting up Django on snow leopard

2010-04-08 Thread CG
Hi Tim, Thank you for responding. When I run: import sys for p in sys.path: print p It does not print anything. The path is to the django site packages is /Library/Python/2.6/site- packages/Django-1.1.1-py2.6.egg/django On Apr 8, 12:26 pm, Tim Shaffer wrote: > What is the absolute path to

Re: Setting up Django on snow leopard

2010-04-08 Thread Tim Shaffer
What is the absolute path to the django site-packages folder? What does the following code output when you run it in the python interpreter? import sys for p in sys.path: print p -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to t

Setting up Django on snow leopard

2010-04-08 Thread CG
Hello, I am trying to setup Django on snow leopard and I am running into some problems. I have succesfully run the install from the command line, and can see the Django folder in my python 2.6 site packages folder. However when I try to import django in the idle tool, I get an error that says Tra

Re: How to concatenate a list of Q objects?

2010-04-08 Thread Daniel
Thank you, Tom. I understand now. I come from java and I was not aware that such a syntax is allowed. I got the Q objects part of my app working thanks to you guys. On Apr 8, 8:08 am, Tom M wrote: > Just to explain > > q = q | f if q else f > > is using the short version of if/else, so let's

Re: How to concatenate a list of Q objects?

2010-04-08 Thread Jared Forsyth
Ok, if I understand correctly, you *don't want* to bitwise OR "|" them short answer: qObjects = [qObject1, qObject2, qObject3] Sample.objects.filter(*qObjects) note the "*". This tells python "expand this list as arguments". cheers Jared On Thu, Apr 8, 2010 at 6:08 AM, Tom M wrote: > Just

facebook email

2010-04-08 Thread CrabbyPete
I am fooling around with the facebook api. Facebook gives you a proxy email address that is to big for the current User email field. Is there a way to extend this field, or should I use another field completely. -- You received this message because you are subscribed to the Google Groups "Django

Admin creating duplicate inlines

2010-04-08 Thread Chris Amico
Hi folks, I have a model with generically-related Link inline objects, and the admin seems to be trying to overwrite attributes on the first inline object with those of the second. This causes an error when trying to save. Here's what the models look like: class Person(models.Model): first_na

Re: /i18n/setlang/ broken?

2010-04-08 Thread Rolando Espinoza La Fuente
On Thu, Apr 8, 2010 at 6:21 AM, chr wrote: > btw, here's the minimal-app: http://github.com/statesofpop/i18ntest Add LocaleMiddleware http://github.com/darkrho/i18ntest/commit/f12abc9a525da2ab9ae3fb3d9c12338bb3295c38 ~Rolando -- You received this message because you are subscribed to the Goog

Re: How to make pagination with haystack

2010-04-08 Thread Ray McBride
Try {% with page as page_obj %} {% paginate %} {% endwith %} Ray On Apr 8, 2:57 pm, Ariel wrote: > Hi everybody: > I am relatively newbie in django, I have an application with search > functionalities that's why I am using haystack with solr, the search work > perfectly but I need to make the p

Writing unit tests that create instances of models with FileFields

2010-04-08 Thread Weeble
When I run "manage.py test" my tests are run without making permanent changes to the database. But when those tests create new model instances with FileFields they create files in the media folder and those are not cleared out automatically. It seems pretty easy to write a custom Storage sub-class

django-mptt

2010-04-08 Thread gradja
Hello all, I try to use django-mptt, i changed my country model in order to be a tree class Country(models.Model): country_name = models.CharField(max_length=30) parent= models.ForeignKey('self', null=True, blank=True, related_name='children') def __unicode__(self): return

Re: How to make pagination with haystack

2010-04-08 Thread Tom Evans
On Thu, Apr 8, 2010 at 2:57 PM, Ariel wrote: > Hi everybody: > I am relatively newbie in django, I have an application with search > functionalities that's why I am using haystack with solr, the search work > perfectly but I need to make the pagination but I have not idea how to do > it, could you

How to make pagination with haystack

2010-04-08 Thread Ariel
Hi everybody: I am relatively newbie in django, I have an application with search functionalities that's why I am using haystack with solr, the search work perfectly but I need to make the pagination but I have not idea how to do it, could you give some help ??? how to do it ??? Thanks in advance,

Re: PicklingError on submit

2010-04-08 Thread clea
Omg that was it! I just named it wrong. Thank you SO MUCH- I copied and pasted that line from somewhere else, and didn't change variable name (terribly stupid mistake). Also you are correct, I do have context as a function in that same file- not a very informative error! In any case- thank you a

Re: PicklingError on submit

2010-04-08 Thread Tom Evans
On Thu, Apr 8, 2010 at 2:00 PM, clea wrote: > Hello- > I am having the following problem: > I have a normal form within an html page (here is a shortened > version): > > > > {% for setting in context.form_options.clinical_settings %} > {{ setting.label }} > {% endfor %} > > value=

PicklingError on submit

2010-04-08 Thread clea
Hello- I am having the following problem: I have a normal form within an html page (here is a shortened version): {% for setting in context.form_options.clinical_settings %} {{ setting.label }} {% endfor %} On submit, I have: def context_form(request): if request.method =

Re: How to concatenate a list of Q objects?

2010-04-08 Thread Tom M
Just to explain q = q | f if q else f is using the short version of if/else, so let's expand that: if q: q = q | f else: q = f q is only False when you have a Q object with no parameters i.e. Q() and as you may have seen above | means OR. This is because the Q object implements the __o

Re: get_fieldname_display in templates

2010-04-08 Thread Ramiro Morales
On Thu, Apr 8, 2010 at 3:00 AM, mmenchu wrote: > I'm trying to write to one of my templates the display name for > item.category. Item is an object with an IntegerField named > 'category' and a set of specified choices. I call render_to_response > and call get_category_display() but I keep getting

Considering Django: How simple is customising django-admin?

2010-04-08 Thread UnclaimedBaggage
Hi folks, Long-time PHP/Zend user here who'd LOVE to switch to Python/Django for webdev work. I've just spent a few hours snooping around Django and really like what I see, but before I invest any real time in it I'd really appreciate some advice on if (or how easily) a few things can be done. My

get_fieldname_display in templates

2010-04-08 Thread mmenchu
I'm trying to write to one of my templates the display name for item.category. Item is an object with an IntegerField named 'category' and a set of specified choices. I call render_to_response and call get_category_display() but I keep getting "Could not parse the remainder: '()'". What's the 'rig

Re: Multi-table inheritance, post_save and fixtures

2010-04-08 Thread Phui Hock
Right, that's a mistake in the example. I fixed it, but the result is an empty string: $ manage.py syncdb --noinput Installing json fixture 'initial_data' from '/home/phuihock/obnob/ inheritance/animal/fixtures'. category: '' Installed 2 object(s) from 1 fixture(s) Just to be a little be clearer,

Re: Multi-table inheritance, post_save and fixtures

2010-04-08 Thread Matthias Kestenholz
On Thu, Apr 8, 2010 at 1:04 PM, Phui Hock wrote: > Given the following block of code: > --- models.py --- > from django.db import models > from django.db.models.signals import post_save > > class Animal(models.Model): >    category = models.CharField(max_length=20) > > class Dog(Animal): >    colo

Re: How can i populate app engine(production environment) database with local sdk database

2010-04-08 Thread Jitesh
I think this works only with django. and not supported by app engine. On Apr 5, 8:45 pm, Roald de Vries wrote: > On Mar 31, 2010, at 9:12 AM, Eximius wrote: > > > Please help me out > > > On Mar 29, 11:04 pm, Eximius wrote: > >> Hi all, > >> I have created a django application using app

Re: set up database engine

2010-04-08 Thread Jitesh
If you are using python 2.5 or later version then you dont have to install anything for SQLight, it is bundled for you in python. Now just edit settings.py file: enter database engine as "sqlite3" and your database name, what you want django to create for you from the models DATABASE_ENGINE = 'sql

Multi-table inheritance, post_save and fixtures

2010-04-08 Thread Phui Hock
Given the following block of code: --- models.py --- from django.db import models from django.db.models.signals import post_save class Animal(models.Model): category = models.CharField(max_length=20) class Dog(Animal): color = models.CharField(max_length=10) def echo_category(sender, **k

Re: /i18n/setlang/ broken?

2010-04-08 Thread chr
btw, here's the minimal-app: http://github.com/statesofpop/i18ntest -- 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+u

Re: /i18n/setlang/ broken?

2010-04-08 Thread chr
thanks for your quick reply. but no, i'm not using GET and for my minimal example app i've used the template snippet as provided in the django dev-docs. On Apr 8, 11:36 am, Baurzhan Ismagulov wrote: > On Thu, Apr 08, 2010 at 02:00:03AM -0700, chr wrote: > > a) switching languages using /i18n/setl

Re: CSRF error while working through tutorial part 4

2010-04-08 Thread David De La Harpe Golden
On 07/04/10 18:59, Gang Fu wrote: Following the instruction, my settings.py has Invalid block tag: 'csrf_token' You're likely looking at the development version of the tutorial but using a released version of django. csrf_token is new, and not used with django 1.1.1. contrast: http://docs

Re: Inline for model causes problem during save

2010-04-08 Thread onorua
Nobody know how to fix this? On 7 апр, 23:16, onorua wrote: > Hello colleagues, > > I have the models.py: > class User(models.Model): >     LastName = models.CharField(max_length=50, verbose_name = > "æÁÍÉÌÉÑ") >     FirstName = models.CharField(max_length=50, verbose_name = "éÍÑ") >     MidleNam

Re: /i18n/setlang/ broken?

2010-04-08 Thread Baurzhan Ismagulov
On Thu, Apr 08, 2010 at 02:00:03AM -0700, chr wrote: > a) switching languages using /i18n/setlang/ doesn't have any effect > anymore Are you per chance using it with GET? It isn't supported any more. With kind regards, -- Baurzhan Ismagulov http://www.kz-easy.com/ -- You received this message

Re: How to concatenate a list of Q objects?

2010-04-08 Thread greatlemer
On Apr 7, 6:26 pm, Vinicius Mendes wrote: > On Wed, Apr 7, 2010 at 2:00 PM, Tom Evans wrote: > > On Wed, Apr 7, 2010 at 5:39 PM, Daniel wrote: > > > Hi, > > > > Thank you for your help everyone.  I know that I need to learn python > > > better, and I did read those articles.  What is still a bit

Re: Noticed some strange behaviour of request.GET.get()

2010-04-08 Thread Alexey Vlasov
Thanks, subdir_path = str(request.GET.get('subdir')) is what I needed. I'm grateful to everybody for detailed answers. Thank you. On Wed, Apr 07, 2010 at 06:59:39PM +0100, Nuno Maltez wrote: > The only difference I can see is that > > request.GET.get ('subdir') > > will return an unicode string

Re: url pattern needed

2010-04-08 Thread Daniel Roseman
On Apr 8, 5:40 am, ydjango wrote: > I have an ajax request coming in like > thishttp://localhost:8000/board/getnames?age=31&sex=1 > > I cannot change it tohttp://localhost:8000/board/getnames/31/1 > > 1) what would be the url pattern to use in urls.py? > > 2) what would be view method - def getna

/i18n/setlang/ broken?

2010-04-08 Thread chr
hi everyone, just spent a few hours trying to find out what's going wrong with i18n... i've just updated a two-year old project (using django- multilingual-ng) to trunk only to find that a) switching languages using /i18n/setlang/ doesn't have any effect anymore b) putting an extra translation.ac

Re: set up database engine

2010-04-08 Thread Thierry CHICH
Perhaps are you confused because of SQLlite. You need to know that SQLite is not a classical database with a server that you need to install. An sqlite database is only a file stored where do you want. Thierry > I mean the tutorial only tells you "edit settings" but doesn't tell > you how. E

Re: set up database engine

2010-04-08 Thread James Bennett
On Wed, Apr 7, 2010 at 11:25 PM, yangyang wrote: > I mean the tutorial only tells you "edit settings" but doesn't tell > you how. Excuse me if this is obvious to most of people. Part 1 of the tutorial, under "Database setup", says: > Now, edit settings.py. It's a normal Python module with module