<commit_before>====================
django-smart-save
====================

Make ``save`` call ``full_clean``.

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
<commit_msg>Make it clear `save` is not modified<commit_after>====================
django-smart-save
====================

Adds the method ``save_if_valid`` to ``Model``, which calls both
``full_clean`` and ``save``.

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

{'fraction_non_alphanumeric': 0.15174418604651163, 'fraction_numerical': 0.013953488372093023, 'mean_word_length': 4.56957928802589, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7404221', 'n_tokens_mistral': 520, 'n_tokens_neox': 471, 'n_words': 210}