diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..058a363 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +# http://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{py,rst,ini}] +indent_style = space +indent_size = 4 + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/README.rst b/README.rst index a7866ba..a5b9458 100644 --- a/README.rst +++ b/README.rst @@ -115,7 +115,7 @@ default value to the first item in the ``STATUS`` choices: from model_utils.fields import StatusField from model_utils import Choices - + class Article(models.Model): STATUS = Choices('draft', 'published') # ... @@ -140,10 +140,10 @@ field changes: .. code-block:: python from model_utils.fields import MonitorField, StatusField - + class Article(models.Model): STATUS = Choices('draft', 'published') - + status = StatusField() status_changed = MonitorField(monitor='status') @@ -247,18 +247,18 @@ returns objects with that status only: from model_utils.models import StatusModel from model_utils import Choices - + class Article(StatusModel): STATUS = Choices('draft', 'published') - + # ... - + a = Article() a.status = Article.STATUS.published # this save will update a.status_changed a.save() - + # this query will only return published articles: Article.published.all() @@ -316,7 +316,7 @@ be returned as their actual type, you can pass subclass names to ``get()`` method: .. code-block:: python - + place = Place.objects.get_subclass(id=some_id) # "place" will automatically be an instance of Place, Restaurant, or Bar