On Dec 16, 2010, at 5:08 PM, Ray Wang wrote:
> Thank you Matt and James for replying so fast.
> I'm also new to django and I'm afraid I might have used the wrong
> -I basically want to add the age, profession fields to the existing
> pinax Profile App. If I want to override a template file for Profile,
> I can create a corresponding file for it in the $PROJECT_ROOT/template
> folder, but the same doesn't seem to apply for models.py under the
> $PROJECT_ROOT/app/profile/model.py. I was wondering how to override
> just that one file in an App.
Individual app files don't work the same way as templates in that regard. The entire app package has to be overridden. Although, in many cases the app will support some level of customization without you having to write your own app.
> I took a look at edios and it seems like it would solve my problem.
The way idios approaches the problem is you write your own profile model (you don't override anything) but you subclass ProfileBase so idios can provide a lot of the generic profile-like capability for you.
> But that was a generic case which I want to apply to other Pinax apps.
> For example, also overriding status update or swap etc.
To the extent that you can't customize via templates or via whatever mechanisms the app provides, you'd need to write your own app.
> After googling more on, I found this: http://www.markus-gattol.name/ws/python_web.html#sec11
> "Overriding build-in Pinax Applications
> Assuming we want to override $PINAX_ROOT/apps/blog with $PROJECT_ROOT/
> apps/blog we can do so simply by copying the application and make our
> project-local (read individual) changes to it. Pinax will then load
> $PROJECT_ROOT/apps/blog rather than $PINAX_ROOT/apps/blog.
> Those who do not care about merging in upstream changes nor submitting
> bugfixes/features upstream would just issue cp -a $PINAX_ROOT/apps/
> blog $PROJECT_ROOT/apps and be done. Those who consider themselves
> good FLOSS-country citizens however care about contributing back as
> well ..."
> I was wondering if that method is a good way to do it (?)
Well, as that article says, if you want to be a good open source citizen, don't do it that way. It's fine, though, if you don't plan to share your customizations back to the community and if you're find not being able to get new updates for that app.
> -For my second question. I actually mean is there a way to copy all
> the pinax code (app/ and template/) into my django app like how a
> normal django app would be structured instead of externally linking. I
> think the above solution might also work in that regard.
You can certainly copy it, just using cp -r or equivalent. But again, that has the caveat that you can't easily share your customizations nor be able to get updates for the app you've copied.