{"id":14972689,"url":"https://github.com/danielgatis/django-smart-save","last_synced_at":"2025-10-26T19:31:46.032Z","repository":{"id":26929351,"uuid":"30391618","full_name":"danielgatis/django-smart-save","owner":"danielgatis","description":"Adds the method save_if_valid to Model, which calls both full_clean and save.","archived":false,"fork":false,"pushed_at":"2023-08-28T11:57:05.000Z","size":18,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T23:04:56.058Z","etag":null,"topics":["django","django-application","django-framework","django-orm","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/django-smart-save","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielgatis.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-06T02:51:50.000Z","updated_at":"2023-11-15T20:27:47.000Z","dependencies_parsed_at":"2022-09-06T14:01:17.899Z","dependency_job_id":null,"html_url":"https://github.com/danielgatis/django-smart-save","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fdjango-smart-save","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fdjango-smart-save/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fdjango-smart-save/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fdjango-smart-save/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielgatis","download_url":"https://codeload.github.com/danielgatis/django-smart-save/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238394323,"owners_count":19464583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","django-application","django-framework","django-orm","python"],"created_at":"2024-09-24T13:47:19.883Z","updated_at":"2025-10-26T19:31:45.728Z","avatar_url":"https://github.com/danielgatis.png","language":"Python","readme":"====================\ndjango-smart-save \n====================\n\n|License|\n\n.. |License| image:: https://img.shields.io/badge/License-BSD%202--Clause-blue.svg\n   :target: https://opensource.org/licenses/BSD-2-Clause\n   \nAdds the method ``save_if_valid`` to ``Model``, which calls both\n``full_clean`` and ``save``.\n   \nMotivation\n==========\n\nDo you think Django models ``save`` method will validate all fields\n(i.e. call ``full_clean``) before saving or any time at all? Wrong!\n\nI discovered this awful truth when I couldn't understand why\na model object with an email field (without `blank=True`) could be\nsaved with an empty string as email address.\n\nMore info:\n\n* \"Why doesn't django's model.save() call full clean?\"\n    http://stackoverflow.com/questions/4441539/\n* \"Model docs imply that ModelForm will call Model.full_clean(), but it won't.\"\n    https://code.djangoproject.com/ticket/13100\n\n\nInstalling\n==========\n\nFirst add the application to your Python path. The easiest way is to use\n`pip`::\n\n    pip install django-smart-save\n\nYou should install by downloading the source and running::\n\n    $ python setup.py install\n\nConfiguring\n-----------\n\nMake sure you have `django.contrib.auth` installed, and add the `smart_save`\napplication to your `INSTALLED_APPS` list::\n\n    INSTALLED_APPS = (\n        ...\n        'django.contrib.auth',\n        'smart_save',\n    )\n\nYou can specify a different method name in your project settings (default: save_if_valid):\n\n    SMART_SAVE_METHOD = 'my_save'\n\n\nUsage Overview\n==============\n\nIt is simple::\n\n    \u003e\u003e\u003e user = User(username=\"chris\")\n    \u003e\u003e\u003e user.save_if_valid()\n    True\n    \u003e\u003e\u003e user = User(username=\"\")\n    \u003e\u003e\u003e user.save_if_valid()\n    False\n    \u003e\u003e\u003e user._errors\n    {'username': ['This field cannot be blank.']}\n\nLicense\n=======\n\nAnyone is free to use or modify this software under the terms of the BSD\nlicense.\n\nBuy me a coffee\n===============\n\nLiked some of my work? Buy me a coffee (or more likely a beer)\n\n|BuyMeACoffee|\n\n.. |BuyMeACoffee| image:: https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png\n   :target: https://www.buymeacoffee.com/danielgatis\n","funding_links":["https://www.buymeacoffee.com/danielgatis"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgatis%2Fdjango-smart-save","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielgatis%2Fdjango-smart-save","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgatis%2Fdjango-smart-save/lists"}