From ab3243eb4906b7e63cbd1e73d882eb288db86210 Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Sat, 17 Mar 2018 22:28:06 -0700 Subject: [PATCH] (pub): publish v0.0.1 - add Installation section to README - move compatibility section to underneath it --- README.md | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index a2ae8f6..e1e08dd 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,33 @@ Django classes to make your models, managers, and querysets serializable, with built-in support for related objects in ~100 LoC (shorter than this README!) +## Installation + +`pip install django-serializable-model` + +It is expected that you already have Django installed + +### Compatibility + +_This was originally used in an older Django 1.5 codebase with Python 2.7._ + +
+ +Should work with Django 1.5-1.9 with Python 2.7. + +Likely works with Django 1.10 and 1.11, though not 100% sure that `._meta.fields` usage works the same way in these. + +Will have some problems with Django 2.0 as the Manager's `use_for_related_fields` has been removed. + +`2to3` shows that there is nothing to change, so should be compatible with Python 3.x + +Have not confirmed if this works with earlier versions of Django or Python. + +
+ +Please submit a PR or file an issue if you have a compatibility problem or have confirmed compatibility on versions. + + ## Usage Simplest use case, just implements the `.serialize()` function on a model: @@ -172,27 +199,6 @@ In order to recurse over relations / joins, it accepts the same arguments as the I'd encourage you to read the source code, since it's shorter than this README :) -## Compatibility - -_This was originally used in an older Django 1.5 codebase with Python 2.7._ - -
- -Should work with Django 1.5-1.9 with Python 2.7. - -Likely works with Django 1.10 and 1.11, though not 100% sure that `._meta.fields` usage works the same way in these. - -Will have some problems with Django 2.0 as the Manager's `use_for_related_fields` has been removed. - -`2to3` shows that there is nothing to change, so should be compatible with Python 3.x - -Have not confirmed if this works with earlier versions of Django or Python. - -
- -Please submit a PR or file an issue if you have a compatibility problem or have confirmed compatibility on versions. - - ## Backstory This library was built while I was working on [Yorango](https://github.com/Yorango)'s ad-hoc API. Writing code to serialize various models was complex and quite tedious, resulting in messy spaghetti code for many of our API methods. The only solutions I could find online were the [Django Full Serializers](http://code.google.com/p/wadofstuff/wiki/DjangoFullSerializers) from [wadofstuff](https://github.com/mattimustang/wadofstuff) as well as some recursive `model_to_dict` snippets online -- none of which gave the option for customizable whitelists and blacklists on a per Model basis.