Re: db/backends/postgresql/opererations.py: sequence_reset_sql problem

2009-04-21 Thread gordyt
I went ahead and filed a bug report (http://code.djangoproject.com/ ticket/10881) and attached two small files that can be used to reproduce the problem. --gordon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djan

Re: db/backends/postgresql/opererations.py: sequence_reset_sql problem

2009-04-21 Thread gordyt
Forgot to mention that I'm running revision 10558. --gordon --~--~-~--~~~---~--~~ 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

db/backends/postgresql/opererations.py: sequence_reset_sql problem

2009-04-21 Thread gordyt
Howdy Folks, I think there is a problem with the sequence_reset_sql method. Here is the the problem area: - cut here - for f in model._meta.many_to_many: output.append("%s setval('%s', coalesce(max(%s), 1), max(%s) %s null) %s %s;" % \ (st

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-14 Thread gordyt
Here is a dpaste link to that same bit of code that looks nicer: http://dpaste.com/hold/33474/ --gordy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to djang

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-14 Thread gordyt
I think I've tracked down the problem. Here is a bit of code from django.db.models.fields.related.py: def get_db_prep_lookup(self, lookup_type, value): # If we are doing a lookup on a Related Field, we must be # comparing object instances. The value should be the PK of value,

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-14 Thread gordyt
Howdy Daniel! > I suspect you have not set the subclass's metaclass to > models.SubfieldBase - see > here:http://docs.djangoproject.com/en/dev/howto/custom-model-fields/#the-s... > > You need to do this to get any of the overridden methods to be called. Thanks for the update, but that isn't the

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-13 Thread gordyt
Forgot to add that I'm using the latest revision from subversion (10558)... --~--~-~--~~~---~--~~ 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 u

Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-13 Thread gordyt
Howdy Folks, I have been testing model inheritance using models that have UUIDField primary keys. It appears that when you save a new instance of a child model, the framework is not calling get_db_prep_value() to convert the UUIDField to a proper format before querying the parent entry. Let's s

Re: Port in use Error

2009-03-17 Thread gordyt
TP I don't know if this applies to your situation or not, but... On an app I'm currently writing I'm using UUID primary keys for some of the models. When creating a new instance of one of those models, say through the admin interface, the development server will start up an instance of a process

Re: Managing over 100 static booleanfield fields Model, Form Class and so on. Profiles process

2009-02-25 Thread gordyt
You could try something like this (in models.py) from django.db import models from django.contrib.auth.models import User # Create your models here. class Interest(models.Model): label = models.CharField(max_length=64) users = models.ManyToManyField(User, blank=True) def __unicode__(

Re: Unusual Schema question

2009-02-23 Thread gordyt
Jay I'm not sure if this would meet your requirements or not, but I think you should take a look at this page concerning generic relations: http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1 Regards, --gordon --~--~-~--~~~---~--~~ You received thi

Re: Writing custom model fields with Multi-table inheritance

2009-02-21 Thread gordyt
> http://code.djangoproject.com/ticket/8813 > > If you could attach the file you dpasted to that ticket and note that you > see this problem in the admin, that would probably be useful, as recreating > it in admin should be easier than recreating the user-defined form, view, > and models involved

Re: Writing custom model fields with Multi-table inheritance

2009-02-20 Thread gordyt
Karen I made a small sample to illustrate the problem and posted it here: http://dpaste.com/hold/123199/ It's an extremely simple test case and instructions are included in the comments. I'm not sure if this error is related to the issue that you told me about or if it is something new entirely

Re: Writing custom model fields with Multi-table inheritance

2009-02-20 Thread gordyt
> This sounds like a problem that has been fixed.  Are you running with a > recent enough trunk or 1.0.X branch checkout so that you have this fix: > > http://code.djangoproject.com/changeset/9664 Karen I'm running build 9846. I'm going to put together a very minimal example to illustrate the pr

Re: Writing custom model fields with Multi-table inheritance

2009-02-20 Thread gordyt
Howdy Viktor, On Feb 1, 1:36 pm, Viktor wrote: > Hi, > > did you got any response or did you managed to solve your problem? > I've just started to search for a UUIDField, and it would be great to > have proper uuid columns for postgres. > > If so do you plan to commit it to django_extensions? S

Writing custom model fields with Multi-table inheritance

2008-12-16 Thread gordyt
Howdy Folks! I wanted to be able to have UUID primary keys for certain models. I found the implementation done by the django_extensions project (http://code.google.com/p/django-command-extensions/) and it works fine as is. But I wanted to be able to have a UUIDField that stored its values in an

Re: aggregation filter?

2008-10-24 Thread gordyt
Forgot to say that I did that test in a sample app called "filters". Hence the table name "filters_member". --g --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: aggregation filter?

2008-10-24 Thread gordyt
Hi kbs, Given this: class Group(models.Model): name = models.CharField(max_length=64) class Member(models.Model): name = models.CharField(max_length=64) group = models.ForeignKey(Group) This will return what you want: Group.objects.extra(where=['id in (select group_id from filt

Re: Django 1.0 for brand new site

2008-10-02 Thread gordyt
Adam I'm using 1.0 with Python 2.5.2 (with Ubuntu servers) for my latest development work and couldn't be happier. --gordon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Django Hangman

2008-10-02 Thread gordyt
Very cute! --g --~--~-~--~~~---~--~~ 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 PROTECTED]

Re: Question about "Writing your first Django app, part 1"

2008-08-31 Thread gordyt
Howdy Artemis, > >>> c = Choice.objects.filter(choice__startswith='Just') > >>> c.poll > > Traceback (most recent call last): >   File "", line 1, in > AttributeError: 'QuerySet' object has no attribute 'poll' Here is what is happening to you. Choice.objects.filter() returns a QuerySet, not a

Re: How to pass queryset to the next request (e.g., search term refinement)?

2008-08-29 Thread gordyt
Howdy Egon! About this part: > Now imagine a human enters search terms into a text input field of a > form, which passes a queryset object instance back to a view, which > then renders /calls to a template where I can make use of that > queryset. > So far correct? When the user enters search te

Re: accessing site settings in templates

2008-07-17 Thread gordyt
Jon I don't see why you couldn't make a custom template tag (see http://tinyurl.com/2zlzf6). I made one to display the current application revision and so to use it in a template is just this: {% revision %} --gordon --~--~-~--~~~---~--~~ You received this messag

Re: Anyone got a backend for MS SQL Server working?

2008-06-27 Thread gordyt
Ulf I haven't played with this second solution, but I did just check out a copy of the django-pyodbc project. You should be OK following the author's instructions. He said to add the django-pydobc directory (where ever you choose to put it) to your PYTHONPATH. The name of the module(s) that get

Re: Where to install additional libraries?

2008-06-23 Thread gordyt
Jamie the command you quoted "python setup.py install" -- on my system I have to run it as root or else do "sudo python setup.py install" -- will copy the files for that module to the appropriate location. If the module you are interested in is in pure Python, with no c-code, you can often just m

Re: Python issues on mac. Python not working.

2008-05-14 Thread gordyt
Jason try this command and see if it works: /usr/bin/python If that takes you into the Python interpreter then you know that Apple's python is still OK. So your only problem is that you have the directory /opt/local/bin in your $PATH ahead of the other directories that are normally in your pa

Re: Multi-page search result

2008-01-27 Thread gordyt
SmileyChris the ObjectPaginator is cool and I'm glad you pointed it out. In my particular case I needed to be able to do more than just paginating large datasets, but for the O.P. it sounds great! --g --~--~-~--~~~---~--~~ You received this message because you a

Re: Multi-page search result

2008-01-27 Thread gordyt
Hi Wanrong, This is a very good question. I had a similar problem that I ended up solving with a non-Django solution because I was adding it to an existing PHP-based site. But I would like to describe what I ended up doing to see if it would be possible to adapt it to Django. In out case we ha

Re: dynamically assigning a field value

2008-01-05 Thread gordyt
Howdy pinco, Off the top of my head I don't see away to avoid the test, but you could bundle it into a method of the Product class: def get_preferred_measure(self, request): if request.session['user_preference'] == "cm": return self.measure_cm return self.measure_in --gordy --

Re: a Django TextMate theme

2008-01-04 Thread gordyt
Cool Bert! Thanks for posting the link. Just tried out this theme and it's pretty nice. --gordy --~--~-~--~~~---~--~~ 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: is there any way to avoid restart apache when changed django code to see the modification

2007-12-23 Thread gordyt
xim you can add MaxRequestsPerChild 1 to your apache config file. This forces Apache to reload everything for each request. Of course be sure and remove that directive in any live configuration! --gordon --~--~-~--~~~---~--~~ You received this message because y

Re: Django Application Without Source?

2007-12-11 Thread gordyt
I had thought the .pyc files were supposed to be portable... On Dec 10, 2:29 pm, "Jay Parlar" <[EMAIL PROTECTED]> wrote: > And if I recall correctly, .pyc files are version dependent, machine > independent, but don't quote me on that :) I did find this post http://www.python.org/search/hype

Re: Django Book Shipping!

2007-12-09 Thread gordyt
hutuworm not to worry... you can purchase a PDF version of the book here: http://www.apress.com/book/view/1590597257 I have done so. It's on my computer now and I can assure you it is available. --g --~--~-~--~~~---~--~~ You received this message because you a

Django Book Shipping!

2007-12-08 Thread gordyt
Greetings All, Just got an email from Amazon saying they have shipped the Django book. Congrats to the team!!! --gordy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Conditional Block in Template

2007-11-27 Thread gordyt
I would have the render_to_response in the view (or views if the URL patterns are different) use the appropriate template based upon the type of request. --gordy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djang

Re: Django rocks: Key Ingredient

2007-11-20 Thread gordyt
Very nice site Jesse! Just created an account and posted my first recipe. --g --~--~-~--~~~---~--~~ 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

Re: Overriding Default Primary Key Type?

2007-11-07 Thread gordyt
Malcolm thanks very much. This is a great idea: > You can't change the underlying data type for the automatically > generated primary key without changing Django's source. > > So your choices are either to write a custom field or, more easily, > manually alter the type of the primary key column

Overriding Default Primary Key Type?

2007-11-06 Thread gordyt
Howdy Folks! I've got a new project coming up that will generate gazillions (that's a technical term for a whole lot) of objects for certain objects in the model. Is it possible to get Django to use a really large integer type for the automatically-generated primary key, like a serial or bigseri

Re: Django on a shared host. The docs are scaring me ;)

2007-07-17 Thread gordyt
Andy here are my notes for setting up Django with Dreamhost using FastCGI: http://www.gordontillman.info/Development/DjangoDreamhost --gordy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Integrating Jasper reports / Reporting in general ??

2007-04-10 Thread gordyt
Joel I recently went through the same process; that is, I migrated from a Java application, using JasperReports to a Python/Django application using ReportLab. It took a bit to get my head around ReportLab, but end the end it has worked out very nicely. --gordon --~--~-~--~~---

Re: runserver detection

2007-04-07 Thread gordyt
Hi chacs66, If you do you setup right you don't have to worry about it. Here is an example. Suppose you have an app called myapp and in the myapp folder you have a urls.py that contains this: urlpatterns += patterns( '', (r'^static_media/(?P.*)$', 'django.views.static.serve', {'doc

Re: get a setting from templates

2007-04-07 Thread gordyt
Howdy Alessandro, This is no problem. You can write a simple context processor that will do what you want. Here is an example: Suppose your app is called myapp and you have a file in your myapp directorory called context_processors.py file with this function: def media_url(request): from

Re: Django IDE

2007-04-05 Thread gordyt
Zeb I'm using Komodo 4.0.2 now and it is a big improvement over 3.x. --gordy On Apr 4, 10:20 pm, "ZebZiggle" <[EMAIL PROTECTED]> wrote: > I've been using it for a couple of years now. I'm still using 3.x, > can't comment on 4.x. The debugging is pretty bad and doesn't really > work as advertised

Re: how do change TextField size on form?

2007-04-05 Thread gordyt
Hi Frank, I'm using the newforms stuff and it lets you do exactly what you want. Here is one of my simpler forms: class AddEditCustomerForm(forms.Form): name = forms.CharField(max_length=200) customer_type_id = forms.ChoiceField(label="Customer Type") notes = forms.CharField(widget=

Re: Django installation on dreamhost

2007-03-07 Thread gordyt
Howdy Equerm, I have some notes posted on using Django with Dreamhost here: http://www.gordontillman.info/Development/DjangoDreamhost --gordy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Django over modpython

2007-02-19 Thread gordyt
On Feb 17, 7:03 am, [EMAIL PROTECTED] wrote: > Yes, most of the hostings have fastCGI, but not flup. > I know the best is to have VPS hosting, but they are very expensive, > and I think I can manage with a shared hosting. > I think Blouehost looks good. I'm not sure about other hosting companies,

Re: how to set the choices of Select Widget by code in the newforms

2007-02-10 Thread gordyt
> I don't think there's any way of accessing the request.user from the > Form class (is there?). If I could pass in the choices when I'm > instantiating the form from views.py my problem would be solved. Is > this possible? Cathy this is absolutely possible. Here is an example from one of my pro

Re: Upgrade from build 4454 to 4463 induced problem in template

2007-02-08 Thread gordyt
Thanks Michael! I just diff'ed all the changes between the two revisions in question and they are truly minor. I know think that the new revision is just reporting an error that was being glossed over silently before. And I never knew about it because, in spite of the error, everything function

Upgrade from build 4454 to 4463 induced problem in template

2007-02-08 Thread gordyt
Howdy Folks! I have been running with trunk revision 4454. I just updated to revision 4463 and a bit of code that has never shown any problems is now broken.. :-( The error being reported is: ProgrammingError at /kindledb/customers/5320/ (1064, "You have an error in your SQL syntax; check the

Re: name 'current_datetime' is not defined

2007-02-03 Thread gordyt
Howdy Mike, > def current_datetime(request): > now = datetime.datetime.now() > html = "It is now %s." % now > return HttpResponse(html) > > - then edit your urls.py to contain > > from django.conf.urls.defaults import * > > urlpatterns = patterns('', > (r'^now/$',

Re: How to Upgrade Django from 0.95 to Current Dev

2007-01-18 Thread gordyt
Johnny I don't know what kind of Operating System you are using, but here is what I do on my Mac and Linux machines... I create a small script "checkout.sh" that contains the following: #!/bin/sh svn co http://code.djangoproject.com/svn/django/trunk/ Make it executable and run it. You will ne

Notes on using Django with FastCGI on DreamHost

2007-01-14 Thread gordyt
Howdy Folks, In case it may help someone else who is interested in using Django with FastCGI on DreamHost, I have posted my setup notes here: http://www.gordontillman.info/Development/DjangoDreamhost --gordy --~--~-~--~~~---~--~~ You received this message beca

newforms: overriding default widget, providing choices, and validation

2007-01-14 Thread gordyt
Howdy Gang, I noticed something interesting with newforms and I'm wondering if I'm doing the right thing or not. Let's say I have the following in one of my forms: customer_type = forms.MultipleChoiceField( required=False, choices=[(c.id,c.description) for c in CustomerType.objects.all()

Re: order_by with Foreign Keys

2007-01-12 Thread gordyt
Hi Carole, There is a workaround for this problem. I am using the latest subversion build of django, so I don't know if it works with the last official build or not. Here is an example: ProductVersion.objects.select_related().order_by("kindledb_product.name","version_number") Here are the mod

Re: Creating a "wizard"

2007-01-12 Thread gordyt
Howdy Bram, Here is an example of something that I am doing with newforms and sessions and it seems to work very well. In my case I have a search form displayed. Depending upon the options that are selected by the user, when they submit the form it will be handled by one of several different vi

Re: Newforms and composite widgets

2007-01-03 Thread gordyt
Adrian I have been experimenting with the SelectDateWidget and I have noticed one bit of strange behavior. Wondering if I'm using it incorrectly. My original element in the form class is this: date_opened = forms.DateField(initial=date.today()) This works as expected and if the data supplied

Re: newforms - updating ChoiceField choices at runtime

2007-01-03 Thread gordyt
Many thanks Honza! I modified my Form class as follows (this is the complete form class, not just a fragment...sorry for all of the choppy lines. Trying to keep from wrapping in the wrong place): class AddEditContactHistoryForm(forms.Form): customer_id = forms.Field( widget=forms.Hid

newforms - updating ChoiceField choices at runtime

2007-01-02 Thread gordyt
Howdy Folks, Here is a fragment of a form definition: class AddEditContactHistoryForm(forms.Form): customer_id = forms.Field(widget=forms.HiddenInput,required=False) contact_history_type_id = forms.ChoiceField(label='Contact Type', choices=[(c.id,c.description) for c in ContactHist

Re: Please comment on this small newforms sample

2006-12-26 Thread gordyt
Thanks Adrian and Alex! Adrian: gotta tell ya I really enjoy working with Django. We had a nice talk about it at our Python user's group meeting here in Houston on 12/19. One of the guys there is the author of the http://houstoncrimemaps.com/ site (pure Django!) --gordy --~--~-~--~-

Please comment on this small newforms sample

2006-12-25 Thread gordyt
Howdy Folks! I'm very new to Django and have been experimenting with newforms. I would be most grateful if anyone would care to take a look at this small sample to see if I'm doing things in an efficient manner. It works great, but I want to make sure I'm not doing something stupid.. :-) To s

Re: How do I make a self-referential Many to Many relationship optional?

2006-12-16 Thread gordyt
Austin here is an object from the model of one of my applications. The self referential many-to-many relationship is optional and works find in the admin interface. Note that you may or may not need the symmetrical part. class Customer(models.Model): """ A Customer is anyone we have so

Re: Getting values from a Drop Down menu

2006-12-16 Thread gordyt
Howdy Matt! Here is a small, complete working sample. When you initially load the page it just displays the choices and prompts you to select a value and click submit. When you submit it, it redisplays the form and then displays what choice you selected. urls.py: from django.conf.urls.defaults