Re: Caching template fragments without specifying expiration time

2009-08-02 Thread Reiner
Be aware that the way the cache key is constructed changed a bit. I'm also invalidating template fragments when models used for rendering changed, and found this while randomly reading changesets: It used to be: fragment_name:additional:arguments:seperated:by:colons Now it is: template.cache.frag

Re: Retrieving the values from query set

2009-08-02 Thread Subramanyam Vemu
Hi Daniel ,Malcom Thanks for the reply That exactly was the solution I wanted On Mon, Aug 3, 2009 at 11:47 AM, Daniel Roseman wrote: > > On Aug 3, 7:03 am, Subramanyam Vemu wrote: > > Hi Malcom > > > > The values_list() returns a list of tuples whereas I am looking for a > simple > > list of th

Re: Retrieving the values from query set

2009-08-02 Thread Daniel Roseman
On Aug 3, 7:03 am, Subramanyam Vemu wrote: > Hi Malcom > > The values_list() returns a list of tuples whereas I am looking for a simple > list of the values > >From the link Malcolm so helpfully provided: "If you only pass in a single field, you can also pass in the `flat` parameter. If True, th

Re: Retrieving the values from query set

2009-08-02 Thread Subramanyam Vemu
Hi Malcom The values_list() returns a list of tuples whereas I am looking for a simple list of the values On Mon, Aug 3, 2009 at 10:48 AM, Malcolm Tredinnick < malc...@pointy-stick.com> wrote: > > On Sun, 2009-08-02 at 21:59 -0700, bvemu wrote: > [...] > > Is there a django way of retrieving on

Re: Caching template fragments without specifying expiration time

2009-08-02 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 01:00 -0400, Nick Fishman wrote: > > and suggests otherwise). It might not be too difficult to add support > > for an optional timeout, although the error checking requires a lot of > > care. > > I think that's the main problem. Since arguments to {% cache %} aren't > named,

Re: Retrieving the values from query set

2009-08-02 Thread Malcolm Tredinnick
On Sun, 2009-08-02 at 21:59 -0700, bvemu wrote: [...] > Is there a django way of retrieving only the values as a list and not > the fieldname Have a look at the values_list() method. That does what you are after. http://docs.djangoproject.com/en/dev/ref/models/querysets/#values-list-fields Reg

Re: Caching template fragments without specifying expiration time

2009-08-02 Thread Nick Fishman
> and suggests otherwise). It might not be too difficult to add support > for an optional timeout, although the error checking requires a lot of > care. I think that's the main problem. Since arguments to {% cache %} aren't named, it doesn't seem possible to differentiate {% cache 500 key1 key2 %

Retrieving the values from query set

2009-08-02 Thread bvemu
Hi In my project I want to store an integer as the username To randomly allocate a new username I need the list of available usernames (integer type list) I tried the following ways user_list=[] user_list=list(User.objects.values('username').order_by('username')) and when I try to print the v

Re: locking up development server

2009-08-02 Thread Rusty Greer
On Sun, Aug 2, 2009 at 9:24 PM, Russell Keith-Magee wrote: > > On Mon, Aug 3, 2009 at 12:01 PM, Rusty Greer wrote: >> >> i added a column to one of my tables in my db.  i added the column in >> the model definition, then i went into mysql and added the column with >> what i think is the appropriat

Re: locking up development server

2009-08-02 Thread Russell Keith-Magee
On Mon, Aug 3, 2009 at 12:01 PM, Rusty Greer wrote: > > i added a column to one of my tables in my db.  i added the column in > the model definition, then i went into mysql and added the column with > what i think is the appropriate alter table command. > the command i used was: >  alter table db_

Re: locking up development server

2009-08-02 Thread Malcolm Tredinnick
On Sun, 2009-08-02 at 21:01 -0700, Rusty Greer wrote: > i added a column to one of my tables in my db. i added the column in > the model definition, then i went into mysql and added the column with > what i think is the appropriate alter table command. > the command i used was: > alter table db

locking up development server

2009-08-02 Thread Rusty Greer
i added a column to one of my tables in my db. i added the column in the model definition, then i went into mysql and added the column with what i think is the appropriate alter table command. the command i used was: alter table db_game add column player_info_url varchar(200) not null; the cod

Re: Using email instead of username in extended "User" model?

2009-08-02 Thread Malcolm Tredinnick
On Sun, 2009-08-02 at 20:21 -0700, Dana wrote: > Oops i mean username, not password. > > Im not clear on how I can get this to override the django login > functionality. Im reading more up on custom auth backends but Ill > admit it's a little confusing. You write a custom authentication function

Re: HELP! pysqlite2 FTS3 and datetime not returning datetime

2009-08-02 Thread Karen Tracey
On Sun, Aug 2, 2009 at 7:06 PM, Carol Hatcher wrote: > > Hi, > > I'm using Django 1.0 and 1.1, pysqlite2 (latest version), sqlite3 > (latest version) and FTS3 (latest > version). > I'm creating some Django models where I recreate the database tables > as virtual tables using > FTS3 so that we can

Re: Using email instead of username in extended "User" model?

2009-08-02 Thread Dana
Oops i mean username, not password. Im not clear on how I can get this to override the django login functionality. Im reading more up on custom auth backends but Ill admit it's a little confusing. Anyone have a finished example of how I can get Django to use email to login (either by making emai

Re: Django newbie deployment question

2009-08-02 Thread Ankur Gupta
Thanks prabhu, Your answer is bang on target. Thanks :). On Aug 2, 4:43 am, prabhu S wrote: > Your apache server would run as www user. Where as you have saved your > project in /root with root as the owner. To do this properly, do not > save your django project in /root. Have it somewhere like

Re: need help with model design and table relationship

2009-08-02 Thread Malcolm Tredinnick
On Sun, 2009-08-02 at 14:08 -0700, Unnamed_Hero wrote: > I have a table with a list of corporations; each corp has a field with > it unique number. > There is a table, filled with people, each record contains a field > with a corp's unique field (where each person works) > > Task: when displaying

Re: Caching template fragments without specifying expiration time

2009-08-02 Thread Malcolm Tredinnick
On Sun, 2009-08-02 at 04:25 -0400, Nick Fishman wrote: > I was wondering if it's possible to not specify the expiration time > when using the {% cache %} tag to cache template fragments. With the > low-level API, cache entries will expire after a timeout configured in > CACHE_BACKEND. Is it possib

Re: Template and substitute

2009-08-02 Thread Malcolm Tredinnick
On Sat, 2009-08-01 at 19:29 -0700, David wrote: > Hi, > > When I tested sql of MySQL in Python interactive shell, I got an > error of "not enough arguments for format string". I checked the > arguments however I could not find anything wrong. > > Can anybody give me a clue? > > Thanks so much.

Re: using the stable api

2009-08-02 Thread Malcolm Tredinnick
On Sat, 2009-08-01 at 19:59 +, Faheem Mitha wrote: > Hi Malcolm, > > Thanks for the helpful reply. > > On Sat, 01 Aug 2009 12:24:29 +1000, Malcolm Tredinnick > wrote: > > > On Fri, 2009-07-31 at 11:42 -0400, Faheem Mitha wrote: [...] > >> 3) Get the sessionid. I had to change request.COOK

Re: 'str' object is not callable

2009-08-02 Thread Ronghui Yu
Try to configure url from (r'^(?P[-\w]+)/$', 'coltrane_category_detail'), to (r'^(?P[-\w]+)/$', coltrane_category_detail), But before that, you need to import this function Or give a whole path to the view like (r'^(?P[-\w]+)/$', 'pack_xxx.mod_xxx.coltrane_category_detail'), On Mon, Aug 3, 2

Re: Using email instead of username in extended "User" model?

2009-08-02 Thread Dana
Tried using that but seems to not do what I need. I couldn't get an email address to save as a password and I am not willing to modify Django or hack my database to do it just yet. On Aug 2, 9:21 am, Darek wrote: > tips&tricks: Email addresses for user > name:http://www.djangosnippets.org/snipp

Re: mysqldb help! Can't connect to MySQL server error...

2009-08-02 Thread Karen Tracey
On Sun, Aug 2, 2009 at 9:16 PM, mdsmoker wrote: > > when running python manage.py syncdb I got the following errors... > > C:\DJANGO~1\mysite>python manage.py syncdb > Traceback (most recent call last): > [snip] super(Connection, self).__init__(*args, **kwargs2) > _mysql_exceptions.Operational

Re: Using email instead of username in extended "User" model?

2009-08-02 Thread Dana
Modification of Django code is not really a path I want to take, I'd prefer a cleaner approach, but thanks for the suggestion! On Aug 2, 11:39 am, cootetom wrote: > Another option you have is to modify the User model directly in the > django source code. > > You will need to edit: > django.contr

Re: Passing an object between views

2009-08-02 Thread Jon Renaut
And that's it? I guess I've always been afraid of the session due to working on web apps with non-traditional architecture (A web app built entirely in PL/SQL, for example). Thanks for the help. On Aug 2, 9:13 pm, Steve Schwarz wrote: > On Sun, Aug 2, 2009 at 6:58 PM, Jon Renaut wrote: > > >

mysqldb help! Can't connect to MySQL server error...

2009-08-02 Thread mdsmoker
when running python manage.py syncdb I got the following errors... C:\DJANGO~1\mysite>python manage.py syncdb Traceback (most recent call last): File "manage.py", line 11, in execute_manager(settings) File "c:\django-trunk\django\core\management\__init__.py", line 362, in execut e_manage

Re: Passing an object between views

2009-08-02 Thread Steve Schwarz
On Sun, Aug 2, 2009 at 6:58 PM, Jon Renaut wrote: > > I would like to use a form to collect a billing address, pass this > address to a new form where I collect credit card info, and then pass > the whole thing to the credit card processor. The only thing I want > to save to the database is a sh

Re: Using email instead of username in extended "User" model?

2009-08-02 Thread Russell Keith-Magee
On Sun, Aug 2, 2009 at 11:56 PM, David Koblas wrote: > > Just to add my $0.02 cents to this, I too would like a better way to > extend django.contrib.auth.models.User than the current approach.  The > two biggest "problems" that I have are: > > * Everything depends on django.contrib.auth.models.Us

Passing an object between views

2009-08-02 Thread Jon Renaut
I would like to use a form to collect a billing address, pass this address to a new form where I collect credit card info, and then pass the whole thing to the credit card processor. The only thing I want to save to the database is a shipping address. Is there a best practice for doing this? Be

Re: Applications as components

2009-08-02 Thread Russell Keith-Magee
On Sun, Aug 2, 2009 at 10:26 PM, Torsten Bronger wrote: > > Hallöchen! > > My first Django project was a single application.  Probably most of > you started this way, with only some other applications shipped with > Django installed on the same site, too. > > However, I now prepare my second Djang

Re: howto change FileField value in model.save() ?

2009-08-02 Thread Carol Hatcher
Hi, You are on the right track. In your save() method you can change the field values for a FileField object, then save it. See the documentation on overriding model methods for more details. You routine would look something like this: def save(self, force_insert=False, force_update=False):

app __init.py__ question

2009-08-02 Thread joep
Hi all, I have both a project and an app I just created (using django-admin). I modified the __init.py__ file in the app to execute a print statement on import. But it gets executed twice when I start the development server. Oddly, it doesn't happen when I set USE_I18N = False in the settings fi

HELP! pysqlite2 FTS3 and datetime not returning datetime

2009-08-02 Thread Carol Hatcher
Hi, I'm using Django 1.0 and 1.1, pysqlite2 (latest version), sqlite3 (latest version) and FTS3 (latest version). I'm creating some Django models where I recreate the database tables as virtual tables using FTS3 so that we can do full text search. Some of the fields in the tables are datetime fie

Re: Django RSS Feeds with adsense

2009-08-02 Thread Alessandro Ronchi
2009/7/9 Juanjux (Google) : > > I don't know the answer to your specific question but you could make a > feedburner RSS from it. Then you can insert adsense for feeds on it > with just a click on adsense settings (it's all integrated.) I'm using feedburner but with another account. I cannot move

Re: psycopyg setup error: no build_ext

2009-08-02 Thread Vasil Vangelovski
From that bash interaction I can assume you are running os x. The absolutely easiest way to install postgresql and psycopg2 on os x is with postgresplus. These links may help if you decide to go down that path: http://www.enterprisedb.com/products/postgres_plus/overview.do http://blog.jonypawk

Re: Django on Hostmonster shared hosting

2009-08-02 Thread Daniel Roseman
On Aug 2, 8:10 pm, Tim wrote: > Hello > > I have been trying to get Django working with Hostmonster.com shared > webhosting with FCGI. > > From what I gather from the HM forums, this is possible, but I've been > hitting some issues. > > I've installed Python 2.6.2 in my home directory, and by all

Re: psycopyg setup error: no build_ext

2009-08-02 Thread Matt Hampel
Setting the pg_config path got me to the next stage of errors, which is a step forward. Thanks! Now I get a permission denied error without any more information or context. Any suggestions? What I tried: matth:psycopg2-2.0.11 matth$ python setup.py build running build running build_py running b

newbie tutorial part 1 startproject doesn't create folder and appropriate files

2009-08-02 Thread mdsmoker
I'm using django 1.1, python 2.5, and windows and i'm brand-spanking new to this. i installed django w/out a problem. python is in my windows path and if i type import django after running python i don't get any errors so I'm assuming it is installed correctly. after i run django-admin.py start

need help with model design and table relationship

2009-08-02 Thread Unnamed_Hero
I have a table with a list of corporations; each corp has a field with it unique number. There is a table, filled with people, each record contains a field with a corp's unique field (where each person works) Task: when displaying info about corporation, also fetch info about people working at.

django-tel new features

2009-08-02 Thread Aaron Maxwell
Hi everyone, django-tel is an app that helps you make "click-to-call" URLs in your mobile web apps. More details are on its github page: http://github.com/hilomath/django-tel/tree/master Since its initial announcement here a few weeks ago, a template tag named "telify" has been added. telify

Re: subclassed ModelForms initial values behavior changed from 1.1beta to 1.1

2009-08-02 Thread David Haas
It looks like the change happened between rev. 10189 & 10190: 10189 displays the value, 10190 doesn't. Unfortunately, I don't think I can give you a completely unbiased answer as to what behavior I think is more correct, because of history and personal use :) With that out on the table, though,

Re: Template links when Django not domain root

2009-08-02 Thread Streamweaver
Thanks. I'm not trying to jump the solution. I'm not the server admin and I have to wait until the weekend is over to get that information from them and I will definitely post it. I was simply asking a question. Trying to come up with a template contexts SITE_URL property isn't an out of bound

Re: Is it possible to combine these two queries?

2009-08-02 Thread David
Thanks Tim. Your reply is quite helpful. On Jul 30, 6:25 pm, Tim Chase wrote: > > al_1 = Alert.objects.filter(creation_date__regex=today).values > > ('dimension1').annotate(Sum('metric1')).order_by('dimension1') > > > and > > > al_2 = Alert.objects.filter(creation_date__regex=yesterday).values

Django on Hostmonster shared hosting

2009-08-02 Thread Tim
Hello I have been trying to get Django working with Hostmonster.com shared webhosting with FCGI. >From what I gather from the HM forums, this is possible, but I've been hitting some issues. I've installed Python 2.6.2 in my home directory, and by all accounts, its working. I've downloaded Djan

Re: Template Architecture: how to render template using several apps?

2009-08-02 Thread Daniel Roseman
On Aug 2, 7:35 am, aleph wrote: > Hi! > > My questions is about "the right way to do it" in Django: I have a > simple message board with two columns: news on the left, the board > itself (input form and messages list) on the right. In fact, this are > two different applications presented in one p

Re: Using email instead of username in extended "User" model?

2009-08-02 Thread cootetom
Another option you have is to modify the User model directly in the django source code. You will need to edit: django.contrib.auth.models.User django.contrib.auth.forms.UserCreationForm django.contrib.auth.forms.AuthenticationForm Find the username field and use the forms.EmailField instead.

'str' object is not callable

2009-08-02 Thread Dolph
hey guys, New to django and I'm just working through James Bennett's practical django projects book, 2nd ed. I'm trying to get the categories section working in the blog and I'm getting the above error. I've read through some of the previous posts to try to figure it out, but I can't seem to figu

Re: Can i add initial admin user?

2009-08-02 Thread djibril
Hi, Try to use 'southdb' for better management. http://south.aeracode.org/wiki/Tutorial cheers On Aug 1, 9:38 am, Mirat Can Bayrak wrote: > i am playing a lot with my models in my project nowadays. On every change i > am deleting my sqlite3 file and running syncdb again.. its ok but creati

Re: Using email instead of username in extended "User" model?

2009-08-02 Thread Darek
tips&tricks: Email addresses for user name: http://www.djangosnippets.org/snippets/74/ On Aug 2, 5:38 pm, Dana wrote: > Hello All, > > I am looking to create a user model that extends the Auth "User" > model, like how James Bennett outlines in his article "Extending the > User Model" [1] by cre

Re: Using email instead of username in extended "User" model?

2009-08-02 Thread David Koblas
Just to add my $0.02 cents to this, I too would like a better way to extend django.contrib.auth.models.User than the current approach. The two biggest "problems" that I have are: * Everything depends on django.contrib.auth.models.User -- which means that while you could swap out your authenti

Using email instead of username in extended "User" model?

2009-08-02 Thread Dana
Hello All, I am looking to create a user model that extends the Auth "User" model, like how James Bennett outlines in his article "Extending the User Model" [1] by creating a FK to the "User" model and everything is going fine other than one issue. I would like to make "email" become the unique

Django formwizard as a context processor?

2009-08-02 Thread 10000angrycats
Has anyone tried to make a FormWizard form (multiple stage form) work across a whole site as a context process? I'm looking at attempting this - have done a context process & a formwizard form, but never tried to 'cross the streams' like this before. In particular, I'll be taking code from forms.

Applications as components

2009-08-02 Thread Torsten Bronger
Hallöchen! My first Django project was a single application. Probably most of you started this way, with only some other applications shipped with Django installed on the same site, too. However, I now prepare my second Django application which will be used together with the first one. For me,

Re: subclassed ModelForms initial values behavior changed from 1.1beta to 1.1

2009-08-02 Thread Russell Keith-Magee
On Sun, Aug 2, 2009 at 12:58 PM, David Haas wrote: > > Ramiro: > > I've set up some models / forms / formsets which demonstrate the > change here: > > http://dpaste.de/YhrI/ > > My initial report wasn't correct - the change in behavior is only seen > when initalizing ModelFormSets . . . the ModelF

Re: Stopping people loging in twice

2009-08-02 Thread Tim Chase
> The main purpose for this would be to track login collisions > and make sure users aren't sharing log in info. > > If a user has a high number of collisions we can assume they > are sharing their credentials and take the appropriate > actions. There are plenty of legitimate reasons for login c

Re: URL & DB question

2009-08-02 Thread Rob B
Well it works a treat so big thanks. 2009/8/2 Chris Withers > > Rob B wrote: > > Great I didn't know about that one. I'm curious to what are the > > benefits of doing it that are? > > Less code for you to write and maintain :-) > > Chris > > -- > Simplistix - Content Management, Batch Processin

Re: modelform validation errors

2009-08-02 Thread zayatzz
Digging in documentation surely helps :) I had to replace {% if pform.non_field_errors %} {{ pform.non_field_errors.as_ul }} {% endif %} with {{ pform.errors }} to see that about field was causing it. I overrid about field with tinymce widg

Re: URL & DB question

2009-08-02 Thread Chris Withers
Rob B wrote: > Great I didn't know about that one. I'm curious to what are the > benefits of doing it that are? Less code for you to write and maintain :-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~

Re: Stopping people loging in twice

2009-08-02 Thread djangou...@gmail.com
The main purpose for this would be to track login collisions and make sure users aren't sharing log in info. If a user has a high number of collisions we can assume they are sharing their credentials and take the appropriate actions. -- Sent from my Palm Pre Tim Chase wrote: > So is there a

Caching template fragments without specifying expiration time

2009-08-02 Thread Nick Fishman
I was wondering if it's possible to not specify the expiration time when using the {% cache %} tag to cache template fragments. With the low-level API, cache entries will expire after a timeout configured in CACHE_BACKEND. Is it possible to use the same default when caching template fragments? In

Re: URL & DB question

2009-08-02 Thread Rob B
Great I didn't know about that one. I'm curious to what are the benefits of doing it that are? Thanks 2009/8/2 Chris Withers > > Rob B (uk) wrote: > > Solved it by doing this: > > > > def profile_detail(request, name): > > p = get_object_or_404(Profile, name=name) > > return render_to_

Re: URL & DB question

2009-08-02 Thread Chris Withers
Rob B (uk) wrote: > Solved it by doing this: > > def profile_detail(request, name): > p = get_object_or_404(Profile, name=name) > return render_to_response('profile_detail.html', {'name': p}) How about using the detail generic view: from django.views.generic.list_detail import object_de