Closed theskumar closed 4 years ago
When it is useful to use the string for you? To avoid importing?
I guess it could be useful for some situation really. Is that compatible with all Django versions? You could also move the import to outside the function. Also, could you include some docs update in the PR?
Awesome!
This is useful as I don't have to keep on importing a model class, while writing tests. In the tests, I generally don't need the model class but the instance of a model.
The support for apps.get_model()
is from Django>=1.7, and the last officially supported django right now is 1.8.
I'll include docs update. :)
Thanks again @theskumar !
I created the PR for that awesome idea: https://github.com/paulocheque/django-dynamic-fixture/pull/104
I'm using this monkey patched version of
G
that acceptsapp_name.ClassName
string format similar to how you would use inmodels.ForeignKey()
.I think it would be a nice backward-compatible add-on to the library itself. @paulocheque thoughts? I'll submit a PR.