https://github.com/danielgatis/django-smart-save
Adds the method save_if_valid to Model, which calls both full_clean and save.
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.4%) to scientific vocabulary
Keywords
django
django-application
django-framework
django-orm
python
Last synced: 5 months ago
·
JSON representation
Repository
Adds the method save_if_valid to Model, which calls both full_clean and save.
Basic Info
- Host: GitHub
- Owner: danielgatis
- License: bsd-2-clause
- Language: Python
- Default Branch: master
- Homepage: https://pypi.org/project/django-smart-save
- Size: 17.6 KB
Statistics
- Stars: 15
- Watchers: 1
- Forks: 3
- Open Issues: 0
- Releases: 0
Topics
django
django-application
django-framework
django-orm
python
Created about 11 years ago
· Last pushed over 2 years ago
Metadata Files
Readme
License
README.rst
====================
django-smart-save
====================
|License|
.. |License| image:: https://img.shields.io/badge/License-BSD%202--Clause-blue.svg
:target: https://opensource.org/licenses/BSD-2-Clause
Adds the method ``save_if_valid`` to ``Model``, which calls both
``full_clean`` and ``save``.
Motivation
==========
Do you think Django models ``save`` method will validate all fields
(i.e. call ``full_clean``) before saving or any time at all? Wrong!
I discovered this awful truth when I couldn't understand why
a model object with an email field (without `blank=True`) could be
saved with an empty string as email address.
More info:
* "Why doesn't django's model.save() call full clean?"
http://stackoverflow.com/questions/4441539/
* "Model docs imply that ModelForm will call Model.full_clean(), but it won't."
https://code.djangoproject.com/ticket/13100
Installing
==========
First add the application to your Python path. The easiest way is to use
`pip`::
pip install django-smart-save
You should install by downloading the source and running::
$ python setup.py install
Configuring
-----------
Make sure you have `django.contrib.auth` installed, and add the `smart_save`
application to your `INSTALLED_APPS` list::
INSTALLED_APPS = (
...
'django.contrib.auth',
'smart_save',
)
You can specify a different method name in your project settings (default: save_if_valid):
SMART_SAVE_METHOD = 'my_save'
Usage Overview
==============
It is simple::
>>> user = User(username="chris")
>>> user.save_if_valid()
True
>>> user = User(username="")
>>> user.save_if_valid()
False
>>> user._errors
{'username': ['This field cannot be blank.']}
License
=======
Anyone is free to use or modify this software under the terms of the BSD
license.
Buy me a coffee
===============
Liked some of my work? Buy me a coffee (or more likely a beer)
|BuyMeACoffee|
.. |BuyMeACoffee| image:: https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png
:target: https://www.buymeacoffee.com/danielgatis
Owner
- Name: Daniel Gatis
- Login: danielgatis
- Kind: user
- Location: Recife - PE
- Repositories: 37
- Profile: https://github.com/danielgatis
GitHub Events
Total
Last Year
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Daniel Gatis | d****s@g****m | 19 |
| Daniel Gatis Carrazzoni | d****s | 5 |
| Pawel Iwaszko | p****o@g****m | 3 |
| David D Lowe | d****m@g****m | 1 |
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 2
- Total pull requests: 2
- Average time to close issues: 2 months
- Average time to close pull requests: 3 months
- Total issue authors: 2
- Total pull request authors: 2
- Average comments per issue: 1.0
- Average comments per pull request: 1.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- iwaszko (1)
- bavugisainath (1)
Pull Request Authors
- Flimm (1)
- iwaszko (1)
Top Labels
Issue Labels
invalid (1)
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 5 last-month
- Total dependent packages: 0
- Total dependent repositories: 2
- Total versions: 1
- Total maintainers: 1
pypi.org: django-smart-save
Automatically validates when you call your model’s save()
- Homepage: https://github.com/danielgatis/django-smart-save
- Documentation: https://django-smart-save.readthedocs.io/
- License: BSD License
-
Latest release: 0.0.11
published over 10 years ago
Rankings
Dependent packages count: 10.1%
Dependent repos count: 11.6%
Stargazers count: 15.2%
Forks count: 19.1%
Average: 23.8%
Downloads: 62.9%
Maintainers (1)
Last synced:
6 months ago