Re: Overriding flatpages class meta

2010-08-31 Thread Owen Nelson
, but hey -- if it works, it works. Owen Nelson On Tue, Aug 31, 2010 at 12:38 PM, Karim Gorjux <lemieli...@gmail.com> wrote: > Try to modify the flatpages source! You can find it directly in your > django installation. > > > -- > Karim Gojux > www.karimblo

Re: Overriding flatpages class meta

2010-08-31 Thread Owen Nelson
The meta class instance is accessed through ClassName._meta -- not ClassName.meta I tried this when I got back last night and had (other) issues myself, so this might not be the right approach anyway. -- You received this message because you are subscribed to the Google Groups "Django users"

Re: Overriding flatpages class meta

2010-08-30 Thread Owen Nelson
Sorry to be guessing here, but I was looking at something similar recently. My attempt (untested at this point) would be something like: from copy import copy class NewFlatpage(FlatPage): _meta = copy(FlatPage._meta) _meta.verbose_name_plural = "foo" -- You received this message because

Re: Model validation for non-django-orm databases

2010-08-30 Thread Owen Nelson
Sounds good. Thanks for the advice! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com.

Re: Model validation for non-django-orm databases

2010-08-30 Thread Owen Nelson
> With the hack i think you mean, it doesn't matter, just pick one, the > point of the hack is you just shamelessly lie to the django ORM. So make > sure to make your model ummanaged and _don't_ try to save. > Excellent. Yeah, I'd been planning on overriding save() to make it raise

Re: models as a package

2010-05-03 Thread Owen Nelson
Something I've seen that isn't particularly well documented (if at all)... If you have a model that isn't in your foo.models (ie, the top models.py for the app), and have a package setup, you need to add an app_name property to your model classes. Example myproject/ foo_app/ <-- needs to be

Re: How to ordered comments by date ???

2010-04-16 Thread Owen Nelson
The comments are already ordered... by pk I assume, which would mean they are also ordered by date (unless you're messing with the comment id's or the dates themselves). If you simply want to switch the order from ascending to descending, maybe try the "reversed" parameter for the "for" tag:

Re: Configure Django with mod_python on Ubuntu server

2010-04-16 Thread Owen Nelson
Opps! Since it's an alias, you need to tell apache what server location to map. For example, if you want http://localhost/ to map to your application: WSGIScriptAlias / /path/to/my/wsgi/my.wsgi Or if you wanted http://localhost/myapp to map instead WSGIScriptAlias /myapp /path/to/my/wsgi/my.wsgi

Re: Configure Django with mod_python on Ubuntu server

2010-04-16 Thread Owen Nelson
The WSGIScriptAlias directive should point directly to the wsgi script -- in your case the line should read: WSGIScriptAlias /home/carlo /home/carlo/mysite/django.wsgi -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Giving up PHP. ...Can't decide between Django & Rails

2010-04-15 Thread Owen Nelson
I came from a job where I had been crafting applications using zend framework - probably the closest thing php has to django. The more object oriented my php code became, the more it looked, and smelled, like java. I ended up taking a new job, where my projects started to have dependencies on

Re: Catching User's First Log in

2010-04-05 Thread Owen Nelson
Although, I guess you could argue that a proxy class with a @property method could achieve the same thing. from django.contrib.auth.models import User as DjangoUser class User(DjangoUser): class Meta: proxy = True @property def is_new(self): return None ==

Re: Catching User's First Log in

2010-04-05 Thread Owen Nelson
I guess it depends on the implementation of the auth backend you're using. Really though, it seems like using a bool flag involves less "magic", and is perhaps more descriptive than making assumptions based on timestamps. if user.is_new: redirect(somewhere) rather than... if user.last_login is

Re: Catching User's First Log in

2010-04-05 Thread Owen Nelson
> it does feel a little bit dirty to me. Me too, that way leads to deciding something is a witch just because it floats. Can't argue with a Bool, and also, it might eventually be nice to be able to flip the bit on a whim (say a user wanted that "out of the box" experience all over again). --

Re: Catching User's First Log in

2010-04-05 Thread Owen Nelson
That would be the strategy I'd employ - however I'd recommend you not add the field to the user itself, but rather its profile. http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users -- You received this message because you are subscribed to the Google

Re: conditional loading of template tags

2010-04-05 Thread Owen Nelson
Tim Shaffer wrote: > I haven't tested this at all, but maybe try putting all the tagging > stuff, include {% load tagging_tags %}, in a separate template, then > wrapping the if statement around an include for that template: > > {% if object.tags %} > {% include "tag_stuff.html" %} > {% endif %}