Re: manager select_related()

2008-08-19 Thread ocgstyles
apparently i pasted that in there twice. woops... On Aug 19, 8:57 am, ocgstyles <[EMAIL PROTECTED]> wrote: > Hi saeb, > > I believe you misunderstand the purpose of select_related().  When > used, it does the extra database work to retrieve related objects at > the beginn

Re: manager select_related()

2008-08-19 Thread ocgstyles
Hi saeb, I believe you misunderstand the purpose of select_related(). When used, it does the extra database work to retrieve related objects at the beginning, rather than when you try to access them. Here's an example: # in this example, notice how __dict__ isn't populated with the

FormWizard Problems

2008-08-18 Thread ocgstyles
I'm experiencing some strange behavior with the Form Wizard. During testing, sometimes I'll get to the last step, click Finish, and I'll get another form with no fields and finish button turns back into a next button. Its set up like this: # urls.py (r'^application/$', MyWizard([Appl1, Appl2,

Re: Model - Only allow One

2008-06-16 Thread ocgstyles
a better way to handle this. On Jun 14, 2:41 pm, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 14 juin, 15:53, ocgstyles <[EMAIL PROTECTED]> wrote: > > > Is there a way create a restriction that will only allow one instance > > of a model? > > T

Model - Only allow One

2008-06-14 Thread ocgstyles
Is there a way create a restriction that will only allow one instance of a model? For example, if I have a model called Zebra, is there a way I can have the Admin interface only allow one Zebra? (In other words, the Add Zebra link will not be visible in the Admin interface. Keith

Re: Template Inheritance and Template Context Processors

2008-04-02 Thread ocgstyles
I saw this: http://www.djangoproject.com/documentation/templates/#custom-libraries-and-template-inheritance Which sounds like it'd be a reason why, but that's for filters. Is there a similar restriction on processors? On Apr 2, 2:03 pm, ocgstyles <[EMAIL PROTECTED]> wrote: > Hi a

Template Inheritance and Template Context Processors

2008-04-02 Thread ocgstyles
Hi all, I added a context processor of my own. So that section of my settings.py looks like: TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n',

Re: Filtering with AND in a list

2008-01-20 Thread ocgstyles
Hi Julien, The "in" filter translates to an SQL in clause, which in turns simulates or functionality like you are experiencing. The type of clause you are looking for is similar to: where x=1 and x=2 and x=3 What I would try to do (and I'm a newbie with all this too) is dynamically create a

Re: remove ^M: project moved from window to linux

2008-01-12 Thread ocgstyles
I need to do that often at work when Windows files are moved over to AIX. I just use vi. The key sequence is: :%s/^M// To create the ^M character, press Ctrl+V, then M. I'm not sure what that character is (never bothered to look), but I think may be that extra control character that Windows

Re: using newforms

2008-01-12 Thread ocgstyles
Figured it out. Just like Kenneth said above, I need a super line where he said. I was also appending the values incorrectly. It should have been GROUP_CHOICES += ((g.id, g.name),) Thanks for the help everyone. On Jan 12, 11:14 am, ocgstyles <[EMAIL PROTECTED]> wrote: > Great. T

Re: using newforms

2008-01-12 Thread ocgstyles
) > > super(MyForm, self) > > Should it not be, >def __init__(self, user, *args, **kwargs): > profile = user.get_profile() > > for g in profile.groups.all(): > self.GROUP_CHOICES += (g.id, g.name) > > super(MyForm, self).__init__(*

using newforms

2008-01-12 Thread ocgstyles
Hi, I using the newforms library to create a form. I need to know who the current user is so I know which values to display in a dropdown control. So I have this so far: from django import newforms as forms class MyForm(forms.Form): GROUP_CHOICES = [] field1 =

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread ocgstyles
d paste in your site's urls.py as well as the app's. > > > On Jan 1, 2008 11:09 PM, Greg <[EMAIL PROTECTED]> wrote: > > > > ocgstyles, > > > I've tried the following combinations however I still get the Page Not > > > Found error: > > > > (r'^

Re: django.contrib.auth.views.password_change

2008-01-01 Thread ocgstyles
James Bennett" <[EMAIL PROTECTED]> wrote: > On Jan 1, 2008 8:01 PM, ocgstyles <[EMAIL PROTECTED]> wrote: > > > {{ form.as_table }} > > > to print out the fields, but that's not happening. Any idea why? > > Because not all components of Django have yet been

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread ocgstyles
-phone_cellphone. On Jan 1, 10:36 pm, Greg <[EMAIL PROTECTED]> wrote: > ocgstyles, > I'm not sure what's going on. What does the last '-' mean in the > following code [a-zA-Z-]? Occasionally I'm going to have the a url > that is going to have a '-' in the variable. For > exa

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread ocgstyles
) Maybe the error is being generated from somewhere else? On Jan 1, 9:42 pm, Greg <[EMAIL PROTECTED]> wrote: > ocgstyles, > I tried the following however I'm still getting a page not found > error: > > (r'^(?P[a-zA-Z-]+)_(?P[\w-]+)/$', 'showline'), > > On Jan 1, 8:23 pm,

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread ocgstyles
Hi Greg, The problem is that "\w" is consuming the underscore. Instead of using [\w-], use [a-zA-Z-]. The pattern would then look like: (r'^(?P[a-zA-Z-]+)_(?P[\w-]+)/$', 'showline') Hope that helps. Keith On Jan 1, 9:05 pm, Greg <[EMAIL PROTECTED]> wrote: > Hello, > I orginially had my url

django.contrib.auth.views.password_change

2008-01-01 Thread ocgstyles
I have a questions regarding the generic authentication views. Lets take the password_change view for example: django.contrib.auth.views.password_change When I look at the source, I can see that the view returning the form PassswordChangeForm as part of the context. So I would imagine in my

Re: Getting related data...

2008-01-01 Thread ocgstyles
pm, "Todd O'Bryan" <[EMAIL PROTECTED]> wrote: > There's probably an easier/more efficient way to do it, but you can do > > services = [] > for p in Profile.objects.all(): > services += p.service_set.all() > > Todd > > On Dec 31, 2007 7:07 PM, ocgstyles

Getting related data...

2007-12-31 Thread ocgstyles
Hi All, I'm trying to figure out how to accomplish something using Django's database API, that I can easily do with SQL. Here's my models: class Service(models.Model): name = models.CharField(max_length=50) class Profile(models.Model): user = models.ForeignKey(User) service =

Re: startproject errors with Ubuntu

2007-08-05 Thread ocgstyles
django-admin.py is a python script that should be ran at the command line: $ django-admin startproject myproject ..should work fine. On Aug 5, 12:43 pm, john <[EMAIL PROTECTED]> wrote: > On Aug 5, 6:43 am, "Jason Ribeiro" <[EMAIL PROTECTED]> wrote: > > > > > The 'python-django' package in

Re: extending django.contrib.auth

2007-08-04 Thread ocgstyles
Perfect. I google'd AUTH_PROFILE_MODULE and found a nice writeup: http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model Looks like that will suit my needs. Thanks On Aug 3, 7:56 am, daev <[EMAIL PROTECTED]> wrote: > You can create Profile model that can have all additional

extending django.contrib.auth

2007-08-03 Thread ocgstyles
Is there a way I can add some attributes to the User model in django.contrib.auth.models and also have those new attributes render in admin? I figure I could just edit the django.contrib.auth.models and add the attributes manually, but that won't last persist through future upgrades.