django-app-gen¶
Generate CRUD views, templates, forms, URLs, and tests for a model. For Django 1.8+ and Python 2.7/3.3+.
Documentation¶
The full documentation is at https://django-app-gen.readthedocs.org.
Quickstart¶
Install django-app-gen:
pip install django-app-gen
Create a model in your app’s models.py file:
from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
Then generate your views, templates, forms, URLs, and tests.:
python manage.py generate_all Question
Add the new URLs to your root urls.py
file. The generated templates and views.py
files assume your URLs are namespaced by your app’s name:
urlpatterns = [
# ...
url(r"^app_name", include("app_name.urls", namespace="app_name")),
# ...
]
Running Tests¶
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements-text.txt
(myenv) $ python runtests.py