Skip to content

Commit

Permalink
(pub): publish v0.0.1
Browse files Browse the repository at this point in the history
- add Installation section to README
  - move compatibility section to underneath it
  • Loading branch information
agilgur5 committed Mar 18, 2018
1 parent 48288e6 commit ab3243e
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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._

<br>

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.

<br>

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:
Expand Down Expand Up @@ -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._

<br>

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.

<br>

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.
Expand Down

0 comments on commit ab3243e

Please sign in to comment.