Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extendable Gallery and Photo models #49

Open
richardbarran opened this issue Apr 18, 2013 · 8 comments
Open

Extendable Gallery and Photo models #49

richardbarran opened this issue Apr 18, 2013 · 8 comments
Milestone

Comments

@richardbarran
Copy link
Owner

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
Copy link
Owner Author

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

@richardbarran
Copy link
Owner Author

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

@richardbarran
Copy link
Owner Author

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
Copy link

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

  • no south migration needed
  • only one failing test case so far.

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

@richardbarran
Copy link
Owner Author

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
Copy link

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

@richardbarran
Copy link
Owner Author

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
Copy link

xordoquy commented Jun 9, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants