Repository navigation
Add Metadata to further models - #4410
Conversation
|
The test is still failing on my test VM, with the error given above - even though it's working here. Odd. It is somehow related to I'm also seeing extra migration files created constantly, with the following content. Strange, anything I need to worry about? Change to slowtests: |
| def get_serializer(self, *args, **kwargs): | ||
| """Return correct MetadataSerializer instance depending on which model is requested""" | ||
| # Get type of report, make sure its one of the allowed values | ||
| UseModel = self._get_model(*args, **kwargs) |
There was a problem hiding this comment.
Can't we use a simpler approach here:
UseModel = self.Meta.model(or similar)?
The endpoint already has either a model or queryset defined, righ?
There was a problem hiding this comment.
This question is for @matmair, he helped out and contributed this part of the code. I'm not sure of the implications / the details of your question..
There was a problem hiding this comment.
@SchrodingersGat not in this case, the model is provided in the url definition as an argument. Reduced the boilerplate as everything is the same for these 4 models. We can type it out if you prefer that. This mainly cuts down on the LoC.
matmair
left a comment
There was a problem hiding this comment.
Lgtm.
There is a caching change I am unsure of - the rest looks great!
|
Fixed as above, and merged latest master into the branch. |
|
@miggland many thanks for the great work here :) |
Adds the metadata mixin, and thus the ability to add metadata to the following models, as mentioned in #4202 (List here is slightly different):
To do: