how to deal with inherited template context variables?

2007-12-27 Thread Sam Lai
New django user here, so if this has been covered already, I'd appreciate a pointer to the right thread. I've been planning and building my app lately, and it's been quite a nice experience so far; django seems very well designed and architected. One thing's been annoying me though. I have a bas

Re: How to add a parent class to the Poll class? (First tutorial)

2007-12-27 Thread Empty
On Dec 27, 2007 5:22 PM, Robert <[EMAIL PROTECTED]> wrote: > > Hi, Sorry about the misunderstanding. > > I am supposed to get this message when I try to add a new object: > > > However, after having added a foreign key in the poll class I receive > this error instead: > > "Poll has no attribute c

Re: Form in base_template.html

2007-12-27 Thread hedronist
Let's separate the problem into: a. Form display, b. Form validation. and c. Page flow or ordering. Form display is trivial for this example, since you only need username and password. This is easily hand-coded into your base template and you don't need to pass anything to the various views. One

what would be the best model for a friend network ?

2007-12-27 Thread [EMAIL PROTECTED]
For a friend / social network, what would be the best model approach ? have a many-to-many asymmetrical recursive relationship ? http://www.djangoproject.com/documentation/models/m2m_recursive/ Or should i have a separate friend model with a friend_from and friend_to referencing the User model

EXPORT PATH in Leopard

2007-12-27 Thread mOne
Hi, I am using Leopard currently and am getting started with Django. I have used it previously on Tiger and have been able to install and work with it no problem. How do I set the path, so that when I type in python django-admin.py startproject mysite, I don't have to type in python /Library/Pyt

Form in base_template.html

2007-12-27 Thread [EMAIL PROTECTED]
Hi all, Let's assume you have a *global* login form in the base_template.html of a blog like application. How would you handle validation of such a form? The form would need to be passed to every view and every view should be made aware of it's validation checking for form.is_valid() Typical us

Re: database library erroneously adding quotes in custom sql

2007-12-27 Thread makebelieve
I figured out a way around it: def benefits_sql(schema): from django.db import connection cursor = connection.cursor() sql = "select * from %s.benefits" %(schema) cursor.execute(sql, []) benefits = cursor.fetchall() return benefits --~--~-~

database library erroneously adding quotes in custom sql

2007-12-27 Thread makebelieve
I'm writing a custom sql method to grab some data from schemas outside of public, but the database library is adding quotes to the schema names which causes an sql error. Any ideas on a way around this? def benefits_sql(schema): from django.db import connection cursor = connectio

www.replicabagwholesaler.com sell replica and copy designer handbag, contact summer ([EMAIL PROTECTED])

2007-12-27 Thread victor
内容:www.replicabagwholesaler.com is a professional dropshipper and wholesaler who supply with the dropship expreience about 2 years and win the good reputation on this line. Our production include various handbags especially new released handbags and most popular series. www.replicabagwholesaler.c

Re: Cannot assign requested address

2007-12-27 Thread James Bennett
On Dec 27, 2007 6:01 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > It seems that this error was coming from HttpResponseRedirect() of the > contact view method, but I did not figure what went wrong. No, look at the traceback. The lines it's highlighting are the ones which send the email, and

Re: User statistics.

2007-12-27 Thread hedronist
> I've already built this stuff, you have to build a database model and > a middleware to track user visit and then calculate how long user was > online. I think we are solving different problems. The code you point to creates data which is ephemeral and only addresses 'who is online'. The Apache

Re: Cannot assign requested address

2007-12-27 Thread Alex Koshelev
Error is in your SMTP parameters in settings.py or something similar. Look at the traceback: 49. return send_mass_mail([[subject, message, from_email, > recipient_list]], fail_silently, auth_user, auth_password) > File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > site-packa

Re: My SSL is not working when I use www.mysite.com...works fine with mysite.com

2007-12-27 Thread hedronist
> I know that google doesn't like redirects. Will this have an effect > on my search rankings? For example if google goes towww.mysite.com...will > google notice the redirect to mysite.com and pentalize me for it? My understanding is that google doesn't like 302's (Temporary Redirect) that much

Re: django site-administration

2007-12-27 Thread goober
Thank you for your response. I could have responded a lot ealier, but I forgot my user account password. Anyway, thank you very much!! Greetings from Virginia, USA. On Dec 26, 4:24 pm, "andrea.dipersio" <[EMAIL PROTECTED]> wrote: > This happen because django have the autoescape set to on by def

Cannot assign requested address

2007-12-27 Thread [EMAIL PROTECTED]
Hello, While I was following the chapter 7 (Form processing) of the django book, I got the following error: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ site-packages/django/core/handlers/base.py" in get_response 77. response = callba

Re: db_index and loading data via fixtures

2007-12-27 Thread Russell Keith-Magee
On Dec 28, 2007 4:12 AM, cesco <[EMAIL PROTECTED]> wrote: > > Hi, > > I recently started using the django-tagging application. The Tag and > TagItem models have each a field which is indexed (db_index=True). > Does loading data with json fixtures change because of having > db_index=True? No. Ther

merhaba every bady

2007-12-27 Thread METIN GUNGORMUS
merhaba every bady --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTE

Re: How to add a parent class to the Poll class? (First tutorial)

2007-12-27 Thread Robert
Hi, Sorry about the misunderstanding. I am supposed to get this message when I try to add a new object: However, after having added a foreign key in the poll class I receive this error instead: "Poll has no attribute choice" Why? On Dec 27, 11:14 pm, [EMAIL PROTECTED] wrote: > > Why do I get

Re: How to add a parent class to the Poll class? (First tutorial)

2007-12-27 Thread gwhit
> > Why do I get this error message? What error are you refering to? Is so that is not a error. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-user

Re: django.db import models

2007-12-27 Thread [EMAIL PROTECTED]
'from django.db import models' means that from the django.db namespace, import the models module. If it had been 'from django.db.models import *' then you can write: class Publisher(Model): name = CharField(max_length = 30) ...because you've actually imported all of the objects _under_ the d

Re: My SSL is not working when I use www.mysite.com...works fine with mysite.com

2007-12-27 Thread Greg
Hedronist, I know that google doesn't like redirects. Will this have an effect on my search rankings? For example if google goes to www.mysite.com...will google notice the redirect to mysite.com and pentalize me for it? Thanks On Dec 27, 12:37 pm, hedronist <[EMAIL PROTECTED]> wrote: > The eas

How do generic views determine for field sizes?

2007-12-27 Thread Steve Bergman
I have a model with several fields, one of which is defined like this: mi = CharField(max_length=1, blank=True) When I use it in a generic create_update form, it sets the size=30 and maxlength=1. This seems odd to me. I can override it with CSS. But why does it make the field so large in the

Re: Check constraint in models

2007-12-27 Thread Eratothene
consider using django add-on django-check-constraints http://code.google.com/p/django-check-constraints/wiki/Features On Dec 26, 12:34 am, [EMAIL PROTECTED] wrote: > Hello, > > Having the following (Postgre)SQL statement: > > CREATE TABLE Games ( >   minPlayer integer NOT NULL DEFAULT 1, >   max

Re: Submit Django book to slashdot book review?

2007-12-27 Thread Pablo Ruiz Múzquiz
I received it today. It would be dishonest to start a review but I'd welcome others'. Regards, Pablo El jue, 27-12-2007 a las 10:39 -0800, walterbyrd escribi�: > A lot of people read slashdot, and slashdot has never done any sort of > story on Django. There have been two stories about TurboGear

Re: My SSL is not working when I use www.mysite.com...works fine with mysite.com

2007-12-27 Thread Greg
Hedronist, I've always heard that google doesn't like it when you have redirects to your site. Will google pentalize me if I redirect all of my www.mysite.com traffic to mysite.com? On Dec 27, 12:37 pm, hedronist <[EMAIL PROTECTED]> wrote: > The easiest way to deal with this problem is to not

[Q] django.db import models

2007-12-27 Thread [EMAIL PROTECTED]
Hello, I am looking for an explanation of what "from django.db import models" does. In the django book, there is an example like this: from django.db import models class Publisher(models.Model): name = models.CharField(maxlength = 30) . I thought that by "from django.db import models" I

Re: Check constraint in models

2007-12-27 Thread Eratothene
django-check-constraints On Dec 26, 12:34 am, [EMAIL PROTECTED] wrote: > Hello, > > Having the following (Postgre)SQL statement: > > CREATE TABLE Games ( >   minPlayer integer NOT NULL DEFAULT 1, >   maxPlayer integer NOT NULL DEFAULT 1, >   CHECK (min_player <= max_player) > ) > > the consequent

db_index and loading data via fixtures

2007-12-27 Thread cesco
Hi, I recently started using the django-tagging application. The Tag and TagItem models have each a field which is indexed (db_index=True). Does loading data with json fixtures change because of having db_index=True? When the data are loaded via fixtures is the save method called on each loaded i

Re: admin interface startup problems

2007-12-27 Thread hedronist
Not having the book yet (it's in the mail) I'm not sure exactly what is on page 84, so I'll make a couple of suggestions/observations. The "No such table" error message means exactly what it says, so this really feels like "python manage.py syncdb" wasn't run (or wasn't run successfully). In add

Submit Django book to slashdot book review?

2007-12-27 Thread walterbyrd
A lot of people read slashdot, and slashdot has never done any sort of story on Django. There have been two stories about TurboGears, but never anything about Django. The Django book has not been out that long. Maybe somebody who knows something about the book should submit the book for review.

Re: My SSL is not working when I use www.mysite.com...works fine with mysite.com

2007-12-27 Thread hedronist
The easiest way to deal with this problem is to not let it happen. A common method is to force the use of a canonical domain name. In your case, mysite.com. If you are using Apache with mod_rewrite, put the following in the site's .htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} !^mysit

Re: Inheritance

2007-12-27 Thread Toby Dylan Hocking
>> I have a lot of models for classifications. All of them have similar >> attributes. When I try to use inheritance in the models design, the >> admin interface doesn't work with ForeignKey fields. >> >> Example: >> >> class BasicModel(models.Model): >> name=models.CharField(maxlength=30) >>

Re: User statistics.

2007-12-27 Thread skam
I've already built this stuff, you have to build a database model and a middleware to track user visit and then calculate how long user was online. For online users please have a look at the following posts: http://groups.google.it/group/django-users/browse_thread/thread/4ba5652bcbd1f958/958c6e77

Re: User statistics.

2007-12-27 Thread hedronist
I'm in the process of building a 'session browser.' 1. The 'who is online' function basically asks 'who has fetched a page in the last N minutes.' The django_session table has an expire_date field which can be converted to a sort of 'time of last click' by subtracting the 'cookie lifetime' from t

Re: How to add a parent class to the Poll class? (First tutorial)

2007-12-27 Thread Empty
I'm not seeing the problem. You might try doing a reset (if you don't mind losing all your data) to be sure that the database is in sync. Michael Trier blog.michaeltrier.com On Dec 27, 2007 10:36 AM, Robert <[EMAIL PROTECTED]> wrote: > > Hi, > > I wanted to expand the Poll example in the first

User statistics.

2007-12-27 Thread grassoalvaro
Hi, I need to know how long user was on the site, who's online (user) and how many guests are online. I was searching for some kind of django- module but didn't find anything. Has anyone already completed module for that? (or) How to build that kind of functionality? Regards. --~--~-~--~

Django (SVN-Version) doesn't execute raw sql-queries

2007-12-27 Thread beewee
Hi, I'm using the latest svn version of django with mysql. Since some time I have the problem that raw UPDATE-queries I execute don't get really executed. Have a look at this: >>> from django.db import connection as con >>> cur = con.cursor() >>> cur.execute('SELECT topic_id FROM forum_vote') 6L

Re: forms.form_for_model

2007-12-27 Thread mike
I finally got it working without using formfield callbacks, I used the "Modifying it Inline" portion of your post, thx for all of the help. Here is a snipped in case it helps anyone else, @staff_member_required def add_edit_customer(request, id=None): if id is None: CustomerEntryForm

How to add a parent class to the Poll class? (First tutorial)

2007-12-27 Thread Robert
Hi, I wanted to expand the Poll example in the first tutorial by organizing polls in groups. I thought this could be done by simply adding a Foreign key to the Poll class. from django.db import models class Pollgroup(models.Model): name = models.CharField(maxlength=200) class Poll(models.M

Re: forms.form_for_model

2007-12-27 Thread mike
Yes, I found your post a while back, that is where I am learning most of this, great post. I tried this and got 'ModPythonRequest' object has no attribute 'customer' I think i am close though, here is my code: else: IssueEntryForm = forms.form_for_model(Issue, fields=('issue''customer

Re: Newform-admin: problem with loading admin templates and templatetags

2007-12-27 Thread Webchemist
> Err, django.contrib.admin isn't in your INSTALLED_APPS. :) Ops... %) Thanks a lot! My mistake... That's the way unhealthy sensations crop up... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group

Re: Having avatar ImageField in UserProfile

2007-12-27 Thread Dmitry Lipovoi
try to get_FIELDNAME_width() and get_FIELDNAME_height() methods of model. On Dec 26, 9:26 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Ok, > > I was able to get much of the stuff going...There's one main question > I have now > > 1) I have an avatar field (ImageField type) in my form..and

Re: Newform-admin: problem with loading admin templates and templatetags

2007-12-27 Thread Jeremy Dunck
On Dec 27, 2007 2:15 AM, Webchemist <[EMAIL PROTECTED]> wrote: > > Jeremy, thanks to reply! > > > What you really want here is to have > > 'django.template.loaders.app_directories.load_template_source' in your > > TEMPLATE_LOADERS. That's really what you want, not add add the admin > > templates

Re: Newform-admin: problem with loading admin templates and templatetags

2007-12-27 Thread Webchemist
On Dec 27, 11:34 am, Julien <[EMAIL PROTECTED]> wrote: > In urls.py, have you set it up properly: > > from django.conf.urls.defaults import * > from django.contrib import admin > > urlpatterns = patterns('', > ('^admin/(.*)', admin.site.root), > ) Naturally, yes! Otherwise admin application

Re: MacOS X Leopard + mod_pyton + mysql problems

2007-12-27 Thread Graham Dumpleton
Known issue. Documented at least for older versions of mod_wsgi at: http://code.google.com/p/modwsgi/wiki/InstallationOnMacOSX Version 2.0 of mod_wsgi includes work around for MacOS X not strictly doing the right thing. :-) Graham On Dec 27, 9:35 pm, Oliver Beattie <[EMAIL PROTECTED]> wrote:

Re: MacOS X Leopard + mod_pyton + mysql problems

2007-12-27 Thread Oliver Beattie
Right, sorted this out. When running setup.py build, it will spit out the compilation command it's executing at the bottom of its output. You will notice that it doesn't include an x86_64 architecture, so you need to add one. Edit the command so it looks like: sudo gcc -Wl,-F. -bundle -undefined

Re: Newform-admin: problem with loading admin templates and templatetags

2007-12-27 Thread Julien
In urls.py, have you set it up properly: from django.conf.urls.defaults import * from django.contrib import admin urlpatterns = patterns('', ('^admin/(.*)', admin.site.root), ) On Dec 27, 7:15 pm, Webchemist <[EMAIL PROTECTED]> wrote: > Jeremy, thanks to reply! > > > What you really want he

Re: MacOS X Leopard + mod_pyton + mysql problems

2007-12-27 Thread Oliver Beattie
I have compiled it for 64-bit: http://farm3.static.flickr.com/2013/2140077639_7abe03b5fb_o.gif Yet I still get this error, am I missing something? I would be reluctant to make force Apache into 32-bit, but if that's the only option... On Dec 27, 12:18 am, Graham Dumpleton <[EMAIL PROTECTED]> w

Re: Passing a dictionary as a query argument?

2007-12-27 Thread Oliver Beattie
I think the pickle modules guarantee that both pickle and cPickle will be able to read each other's pickles, but that's about it. Aside from unpickling every database object on every database query, though, I see no other alternative (aisde from writing my own pickle module [eek]). And thanks for

Re: Newform-admin: problem with loading admin templates and templatetags

2007-12-27 Thread Webchemist
Jeremy, thanks to reply! > What you really want here is to have > 'django.template.loaders.app_directories.load_template_source' in your > TEMPLATE_LOADERS. That's really what you want, not add add the admin > templates to TEMPLATE_DIRS. This template loader was enabled of cause from the beginn