--
You received this message because you are subscribed to the Google Groups "Pinax Users" group.
To post to this group, send email to pinax...@googlegroups.com.
To unsubscribe from this group, send email to pinax-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pinax-users?hl=en.
> Hi,
>
> I've just gotten started with Pinax and it has some great features out
> of the box.
>
> I had a couple question on non-design related things:
>
> 1.) While I found overriding templates intuitive and easy. I was
> wondering how you would override things such as models.py and
> views.py. For example, if I want to extend the the profile module to
> add fields such as profession and age, how would I do it in the
> existing framework?
Take a look at idios:
https://github.com/eldarion/idios
> 2.) Is there anyway to have all the pinax modules be copied to my app
> and run from there instead of a pinax directory? I find it's adds
> extra work to refer to the pinax file system to find a template name
> and override it in my app instead of directly editing it.
I'm confused whether you're talking about the modules or the templates (you seem to start off talking about one then switch to the other)
James
> Hi,
>
> 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
> terminology:
>
> -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.
James