richardbarran / django-photologue

A customizable plug-in photo gallery management application for the Django web framework.
BSD 3-Clause "New" or "Revised" License
675 stars 239 forks source link

Extendable Gallery and Photo models #49

Open richardbarran opened 11 years ago

richardbarran commented 11 years ago

As per title.

If we can make these models extendable by the user, we will make them a lot more useful - in particular it will help with django-imagekit so that users can create custom effects etc... for their project.

Could be based on something similar to what is used for Django-oscar, so Gallery and Photo could be abstract classes; the user can import and extend these models in his own project, and use settings to tell Photologue about these new models.

Whenever Photologue import Gallery or Photo, it will search first for a model defined in the settings, then fall back to its own version.

richardbarran commented 11 years ago

Note: will need documentation to explain how it works + some unit tests.

richardbarran commented 11 years ago

The new User model in Django 1.5 could be a good design to follow.

richardbarran commented 11 years ago

Note: @xordoquy indicated at the last DjangoCon that he would be very interested in this feature and might code it - anyone interested in working on this should contact him first to avoid any duplicated effort!

xordoquy commented 11 years ago

Started some work on my way back to Paris. Here's a preview with:

See https://github.com/linovia/django-photologue/tree/feature/customizable_models

richardbarran commented 11 years ago

Woah, that was fast.

I need to catch up with work for various clients over the next few days, but next weekend is 'jour férié' here in the UK so I will certainly look at it then!

xordoquy commented 11 years ago

Actually it's still work in progress. Still need to make sure ti works with a custom model.

richardbarran commented 11 years ago

Tried my hand at extending the Gallery model - @xordoquy, I didn't want to interfere with your work on extending Photos, and I wanted to understand a bit better myself how this feature works. I've put my work so far on branch 'dynamic_models'. I've based much of my code on what you did - something I blindly copied is the 'swappable' Meta attribute - not sure what it does? And it does prevent the application from working in Django 1.4. Well, it's just a proof-of-concept for now...

xordoquy commented 11 years ago

Hi @richardbarran, indeed it's for Django 1.5 It mostly does what Django does for the custom user model. I probably need to add an example. Will try to find some time this week to do that.