Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dffa483
commit fa86760
Showing
9 changed files
with
79 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
*.db | ||
*.log | ||
local_settings.py | ||
test_project/things/ | ||
test_project/templates/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
=============== | ||
django-startcbv | ||
=============== | ||
|
||
Installation | ||
------------ | ||
|
||
TODO: package this up. At some point it will be:: | ||
|
||
Add django-startcbv==0.1 to requirements.txt | ||
pip install -r requirements.txt | ||
|
||
Usage | ||
----- | ||
|
||
For all of the following steps, replace "things" with the name of the app that you wish to create:: | ||
|
||
python manage.py startcbv things | ||
|
||
Add your "things" app to INSTALLED_APPS in settings.py:: | ||
|
||
INSTALLED_APPS = ( | ||
... | ||
'things', | ||
) | ||
|
||
Add your "things" app URL pattern to urls.py:: | ||
|
||
url(r'^things/', include('things.urls')), | ||
|
||
Then:: | ||
|
||
python manage.py syncdb | ||
python manage.py runserver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.contrib import admin | ||
|
||
from {{ app_name }}.models import {{ model_name }} | ||
|
||
class {{ model_name }}Admin(admin.ModelAdmin): | ||
list_display = ('name', 'slug', 'pub_date') | ||
fields = ['name', 'slug', 'pub_date'] | ||
prepopulated_fields = {"slug": ("name",)} | ||
save_on_top = True | ||
search_fields = ['name'] | ||
|
||
admin.site.register({{ model_name }}, {{ model_name }}Admin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
from django.conf.urls.defaults import patterns, include, url | ||
|
||
# Uncomment the next two lines to enable the admin: | ||
# from django.contrib import admin | ||
# admin.autodiscover() | ||
from django.contrib import admin | ||
admin.autodiscover() | ||
|
||
urlpatterns = patterns('', | ||
# Examples: | ||
# url(r'^$', 'test_project.views.home', name='home'), | ||
# url(r'^test_project/', include('test_project.foo.urls')), | ||
url(r'^admin/', include(admin.site.urls)), | ||
|
||
# Uncomment the admin/doc line below to enable admin documentation: | ||
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')), | ||
|
||
# Uncomment the next line to enable the admin: | ||
# url(r'^admin/', include(admin.site.urls)), | ||
# The appropriate URL pattern for your app should be placed here manually AFTER | ||
# you've run 'python manage.py startcbv things' | ||
# url(r'^things/', include('things.urls')), | ||
) |