Re: get_absolute_url() and related models

2009-02-24 Thread Ben Davis
Thank you so much! It's funny because I had originally tried category__slug, not sure why it didn't occur to me to use self.category.slug ! Also, I'm glad to have learned about select_related() -- that's exactly what I was looking for! On Mon, Feb 23, 2009 at 6:36 PM, Malcolm Tredinnick < m

Compressed fixtures?

2009-03-06 Thread Ben Davis
http://docs.djangoproject.com/en/dev/ref/django-admin/#compressed-fixtures The docs say that you can use compressed fixtures, but I haven't gotten this to work. For example, I have myapp/fixtures/myfixture.yaml.gz, but when I run ./django-admin.py loaddata myapp/fixtures/myfixture.yaml, it just

Re: Compressed fixtures?

2009-03-07 Thread Ben Davis
Ahh. Searching for "compressed fixtures" on djangoproject.com under the "1.0" documentation option reveals the following page: http://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocs That page has the "1.0 Docs" label, so I'm guessing this is an error in the documentation? Is there

I can't decide on a migration framework

2009-03-07 Thread Ben Davis
I've been looking into both the "South" and "django-evolution" migration frameworks. There are things I like about both of them, although I'm leaning towards django-evolution. The thing I like about django-evolution is that migrations are described in the same "language" as your model, that is,

Re: I can't decide on a migration framework

2009-03-09 Thread Ben Davis
anges needed when you run syncdb. So in order to controll evolutions you would need to change to model fields. On 7 Mar., 23:59, Ben Davis wrote: > I've been looking into both the "South"... > claims<http://south.aeracode.org/wiki/Alternatives>to have started the > p

Re: I can't decide on a migration framework

2009-03-09 Thread Ben Davis
Thanks Russ! Your insight is greatly appreciated. On Mon, Mar 9, 2009 at 8:58 PM, Russell Keith-Magee wrote: > > On Tue, Mar 10, 2009 at 8:23 AM, Ben Davis wrote: > > are you saying that django-evolution does not support migrating between > > "versions" (ie up and

Re: Return FK model

2009-09-03 Thread Ben Davis
It looks you're setting a many-to-many reflexive (circular) relationship between users. It seems it would be better to add a ManyToManyField on the User model, eg: class User(models.Model): ... friends = ManyToManyField(User) Then you could just use "user.friends" On Thu, Sep 3, 200

Re: Return FK model

2009-09-03 Thread Ben Davis
Make sense? On Thu, Sep 3, 2009 at 10:17 AM, Yanik wrote: > > Well, I can't add very well add fields to the Auth.User. But even if I > could, user.friends would get me instances of "Friend" model, not > "User" model. > > On Sep 3, 11:13 am, Ben Dav

Re: Return FK model

2009-09-03 Thread Ben Davis
r relation should be OneToOneField, not ForeignKey. On Thu, Sep 3, 2009 at 10:49 AM, Javier Guerra wrote: > > On Thu, Sep 3, 2009 at 10:41 AM, Ben Davis wrote: > > The django docs suggest using a UserProfile model when you need to add > more > > infor

Re: are you using mptt, treebeard or something else?

2009-09-03 Thread Ben Davis
>From what I understand, Treebeard has better performance, but mptt has (I think) been around longer. I've messed around w/ mptt, but looking through treebeards benchmarks, it looks like treebeard might be more well thought out. As far as admin support goes, I don't think either has "offic

Re: create non-form widgets like a ajax driven table

2009-09-07 Thread Ben Davis
In django terms, a table is not a widget. Widgets are basically different input methods for form fields. Django's admin app has a built-in list view (I think it's called changelist) which you can customize or override. It basically just takes some effort to dig into the admin contrib app to se

Re: default settings for applications

2009-06-05 Thread Ben Davis
I'm not sure that there's a real "standard" for it, but that's more or less what I've done for my projects, except my multi-environment setup looks like this: settings/ __init__.py defaults.py development.py staging.py production.py all my default/common settings go in defau

Re: Django gives little information about custom raised exceptions

2009-06-17 Thread Ben Davis
This is just a shot in the dark, but you might try setting the "message" property on your exception object. It could be that django's pretty exception printing is calling that directly instead of casting to a string. If that's the case, you should file a bug because Exception.message is deprecat

Re: Template Question

2009-06-17 Thread Ben Davis
Nope, you'll need to set a variable in your view. You can also try creating your own filter such that {% if friend|is_in_group %} would work (it's pretty easy to do, just check out the docs for custom template filters) On Tue, Jun 16, 2009 at 2:40 PM, CrabbyPete wrote: > > Is there a way do so

Re: Alternate authentication

2009-06-17 Thread Ben Davis
I believe what you are looking for is a custom authentication backend. I had to do this for one of my sites that used an XMLRPC api to authenticate against a remote server. You'll want to create a class that extends django.contrib.auth.backends.ModelBackend , and add it to the AUTHENTICATION_BAC

Authentication for static files

2009-09-26 Thread Ben Davis
I would like to be able to serve files that were uploaded via the admin site; for example, when someone clicks on the "Currently:" file link in the changeform. However, I also have the following requirements: 1. The file should only be accessible when authenticated via django's auth system

Re: Authentication for static files

2009-09-27 Thread Ben Davis
t; > On Sep 27, 3:08 am, Ben Davis wrote: > > I would like to be able to serve files that were uploaded via the admin > > site; for example, when someone clicks on the "Currently:" file link in > the > > changeform. However, I also have the following requirements: