Re: little problem with the django template language

2008-06-20 Thread Daniel Roseman
On Jun 20, 8:50 am, mark <[EMAIL PROTECTED]> wrote: > I guess it was a little confusing how I formulated my problem. I just > try again. Sorry for that. > > In Python what I want to do would look like the following: > > item1 = '/test/something/' > item2 = '/test/somethingelse/' > > if i

Re: little problem with the django template language

2008-06-20 Thread mark
I guess it was a little confusing how I formulated my problem. I just try again. Sorry for that. In Python what I want to do would look like the following: item1 = '/test/something/' item2 = '/test/somethingelse/' if item2.startswith(item1): do_the_trick() Now since Django has thi

Re: little problem with the django template language

2008-06-19 Thread phillc
yes they are strings, yes in python if you do if item1: pass it will evaluate the string as a true/false depending on existance. however, comparing two strings for equality... checks if they are equal. {% if item1 %} {% if item2 %} blah {% endif %} {% endif %} On Jun 19, 1:50 pm, mark <[

Re: little problem with the django template language

2008-06-19 Thread roj
Hi, If you are trying to compare url string then use request.path which will give you URL and split by "/" is that work for you? Cheers! Roj Django Debugging Resource http://django.freelancernepal.com On Jun 19, 6:50 pm, mark <[EMAIL PROTECTED]> wrote: > Hi, > > I am stuck, please help. > > T

little problem with the django template language

2008-06-19 Thread mark
Hi, I am stuck, please help. This is what I am trying to do: {% ifequal item1 item2 %} ...do what I want item1 = '/test/something/' item2 = '/test/somethingelse/' or item1 = '/test/' tem2 = '/test/simething' both should evaluate to true and execute the if block. I experimented with 'it

Re: Newbie: Big problem or little problem?

2008-01-07 Thread rob_mazur
Another data point is that I still error in the interpreter (see below). Using "which python" I can see I am using the newly compiled version of python, which has the MySQLdb module installed. It appears I still have something fouled up? Rob -- [EMAIL PROTECTED]:~/home/m

Re: Newbie: Big problem or little problem?

2008-01-07 Thread rob_mazur
Thanks for your help, Gang. I have it working (though I still have a question below). I actually did see the error regarding the MySQLdb module, but I thought, "OK, I can fix that later, but what are these other errors?" I did not think they were related. So I then ran into this error: File

Re: Newbie: Big problem or little problem?

2008-01-07 Thread [EMAIL PROTECTED]
go into a python prompt and run: >>> import MySQLdb If it works, then your backend database is installed properly. If not, you need to do more to get the DB configured. http://www.djangoproject.com/documentation/install/#get-your-database-running Ivan On Jan 7, 12:02 pm, rob_mazur <[EMAIL PROT

Re: Newbie: Big problem or little problem?

2008-01-07 Thread Tim Riley
If you are going to use a mysql database you need the mysqldb python package installed. http://sourceforge.net/projects/mysql-python On Jan 7, 2008 3:02 PM, rob_mazur <[EMAIL PROTECTED]> wrote: > > I just installed Django 0.96 (Python 2.4.1) and am running through the > tutorial at Django's site

Re: Newbie: Big problem or little problem?

2008-01-07 Thread Joshua D. Drake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mon, 7 Jan 2008 12:02:51 -0800 (PST) rob_mazur <[EMAIL PROTECTED]> wrote: > > I just installed Django 0.96 (Python 2.4.1) and am running through the > tutorial at Django's site. I can run "import django" at the > interactive interpreter. But whe

Newbie: Big problem or little problem?

2008-01-07 Thread rob_mazur
I just installed Django 0.96 (Python 2.4.1) and am running through the tutorial at Django's site. I can run "import django" at the interactive interpreter. But when launching the integrated webserver and viewing http://127.0.0.1:8000/ I get the error list below. Can someone have a quick look, j

Re: little problem

2007-07-13 Thread JeffH
Jacob: Great! I have played it safe with the getattr construct, figuring that the new object instance _might_ be constructed with an id attribute set to None prior to save(). On Jul 13, 2:46 pm, "Lic. José M. Rodriguez Bacallao" <[EMAIL PROTECTED]> wrote: > thanks, that work more efficient that m

Re: little problem

2007-07-13 Thread Lic. José M. Rodriguez Bacallao
thanks, that work more efficient that my way of do it, I was getting the user from the database to see if the user exist. I like your solution, is pretty clean and simple. Thanks a lot. On 7/13/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > > On 7/13/07, JeffH <[EMAIL PROTECTED]> wrote: > >

Re: little problem

2007-07-13 Thread Jacob Kaplan-Moss
On 7/13/07, JeffH <[EMAIL PROTECTED]> wrote: > > if getattr(model_instance, 'id', None) is None: > model_instance.created_by = whatever > Also take a look at ``hasattr()``: http://docs.python.org/lib/built-in-funcs.html#l2h-35 Jacob --~--~-~--~~~---~--~~ You re

Re: little problem

2007-07-13 Thread JeffH
this works for me: if getattr(model_instance, 'id', None) is None: model_instance.created_by = whatever On Jul 13, 1:28 pm, "Lic. José M. Rodriguez Bacallao" <[EMAIL PROTECTED]> wrote: > Hi, I got a little problem. I need to store in a model the first user who

little problem

2007-07-13 Thread Lic. José M. Rodriguez Bacallao
Hi, I got a little problem. I need to store in a model the first user who created it (created_by) and the user who last modified it (last_modified_by). So, with the second one, there is no problem, every time a user save the object, the pre_save signal is dispatched and I catch it so I can set the

is this a bug... Model/admin little problem

2007-02-20 Thread enquest
I got the following problem: On my developing server everything is fine. On my deployment server (apache) I have the problem The problem: Hotel dissapears in the admin when I import the country.models I tryied about everthing with many apache restarts and many changes.. If I simple add the clas

Re: follow-the-tutorial.. little problem..

2006-10-04 Thread ian
Marco Amato wrote: > Hi ! > > I am in the part 2 of the tutorial after add the class Admin in evere > object and uncommenti in url.py the admin url > > I receive this error from the server : > > SuspiciousOperation at /admin/ > User tampered with session cookie. > Request Method: GET > Re

follow-the-tutorial.. little problem..

2006-10-04 Thread Marco Amato
Hi ! I am in the part 2 of the tutorial after add the class Admin in evere object and uncommenti in url.py the admin url I receive this error from the server : SuspiciousOperation at /admin/ User tampered with session cookie. Request Method: GET Request URL:http://127.0.0.1:8000/adm