Skip to content

Conversation

nitely
Copy link
Owner

@nitely nitely commented Jun 22, 2016

Fixes #7

Changes:

  • HookModels: allow models to be extended by adding new fields/methods to them.
  • Readme: improved "Why?" section.

@coveralls
Copy link

coveralls commented Jun 22, 2016

Coverage Status

Coverage increased (+0.06%) to 93.733% when pulling 127107a on feature/modelhook into 26ea215 on master.

@nitely
Copy link
Owner Author

nitely commented Jun 22, 2016

I'm not merging this just yet, mostly coz of the lack of tests. But I'm pretty satisfy by the way this works so far.

abstract = True

def save(self, *args, **kwargs):
updated_at = timezone.now()
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shoud be self.updated_at

@nitely
Copy link
Owner Author

nitely commented Jul 6, 2019

I can't decide whether this is a good or bad idea. Except for the potential clash in field names I see no downsides. It avoids resorting to oneToOneField and have N extra join (N == Number of plugins), and it makes working with forms and ordering their fields easier (or possible at all).

But I've not merged it in 3 years, so closing this.

@nitely nitely closed this Jul 6, 2019
@nitely
Copy link
Owner Author

nitely commented Jan 2, 2021

I think this is a bad idea because it won't handle migrations well. We would need to ask the final user to create a concrete model, so all migrations are stored on the user project side instead of as part of django-hooks, mainly because when django-hooks is updated the migrations will be deleted. This also has major caveats, the main app will have no way to create data migrations when needed, since the migrations won't be stored in that app, but in some user custom app.

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

Successfully merging this pull request may close these issues.

Model hook
2 participants