django.contrib.databrowse
whoami: Eddy Mulyono <ul><li>lazy
magic-removal
MS in CS thesis </li><ul><li>need quick UI </li></ul></ul>
who: Survey <ul><li>Use databrowse
Hack databrowse </li></ul>
Outline <ul><li>Intro
Docs
Demo
Dive </li></ul>
django.contrib.admin <ul><li>RW
RO? </li></ul>
django.contrib.databrowse
INSTALL <ul><li>admin </li></ul><ul><li>databrowse </li></ul>
INSTALLED_APPS <ul><li>django.contrib.admin </li></ul><ul><li>django.contrib. databrowse </li></ul>
urls.py <ul><li>from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # … (r'^admin/', include(...
register <ul><li>from mysite.polls.models import Poll from django.contrib import admin admin.site.register(Poll) </li></ul...
(teaser)
Multi-site <ul><li>admin.site </li><ul><li>admin/__init__.py: </li><ul><li>from django.contrib.admin.sites import AdminSit...
Upcoming SlideShare
Loading in...5
×

django.contrib.databrowse

2,942

Published on

Slides for my django.contrib.databrowse presentation given at BayPIGgies on 2009-Oct-22.

Published in: Technology, Design
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,942
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
21
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

django.contrib.databrowse

  1. 1. django.contrib.databrowse
  2. 2. whoami: Eddy Mulyono <ul><li>lazy
  3. 3. magic-removal
  4. 4. MS in CS thesis </li><ul><li>need quick UI </li></ul></ul>
  5. 5. who: Survey <ul><li>Use databrowse
  6. 6. Hack databrowse </li></ul>
  7. 7. Outline <ul><li>Intro
  8. 8. Docs
  9. 9. Demo
  10. 10. Dive </li></ul>
  11. 11. django.contrib.admin <ul><li>RW
  12. 12. RO? </li></ul>
  13. 13. django.contrib.databrowse
  14. 14. INSTALL <ul><li>admin </li></ul><ul><li>databrowse </li></ul>
  15. 15. INSTALLED_APPS <ul><li>django.contrib.admin </li></ul><ul><li>django.contrib. databrowse </li></ul>
  16. 16. urls.py <ul><li>from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # … (r'^admin/', include(admin.site.urls)), </li></ul><ul><li>from django.contrib import databrowse urlpatterns = patterns('', # … (r'^databrowse/(.*)', databrowse.site.root) , </li></ul>
  17. 17. register <ul><li>from mysite.polls.models import Poll from django.contrib import admin admin.site.register(Poll) </li></ul><ul><li>from myapp.models import SomeModel, SomeOtherModel from django.contrib import databrowse databrowse.site. register(SomeModel) databrowse.site. register(SomeOtherModel) </li></ul>
  18. 18. (teaser)
  19. 19. Multi-site <ul><li>admin.site </li><ul><li>admin/__init__.py: </li><ul><li>from django.contrib.admin.sites import AdminSite, site </li></ul><li>admin/sites.py: </li><ul><li>site = AdminSite() </li></ul></ul><li>site2 = admin.sites. AdminSite() </li></ul><ul><li>databrowse.site </li><ul><li>databrowse/__init__.py: </li><ul><li>from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site </li></ul><li>databrowse/sites.py: </li><ul><li>site = DatabrowseSite() </li></ul></ul><li>site2 = databrowse.sites. DatabrowseSite() </li></ul>
  20. 20. Customize <ul><li>ModelAdmin </li><ul><li>admin.site.register(Poll, PollAdmin) </li></ul></ul><ul><li>ModelDatabrowse </li><ul><li>databrowse.site. register(SomeModel, SomeModelDatabrowse) </li></ul></ul>
  21. 21. databrowse.ModelDatabrowse <ul><li>plugins </li><ul><li>class DefaultModelDatabrowse(ModelDatabrowse): plugins = {'objects': ObjectDetailPlugin(), 'calendars': CalendarPlugin(), 'fields': FieldChoicePlugin()} </li></ul></ul>
  22. 22. databrowse.plugins <ul><li>ObjectDetailPlugin
  23. 23. CalendarPlugin
  24. 24. FieldChoicePlugin </li></ul>
  25. 25. databrowse.DatabrowsePlugin <ul><li>model_index_html
  26. 26. model_view </li></ul>
  27. 27. absolute_url <ul><li>get_absolute_url </li><ul><li>return ('databrowse', ('polls/poll/objects/%i/' % self.pk,), {}) </li></ul></ul>
  28. 28. Q&A
  29. 29. references <ul><li>http://docs.djangoproject.com/en/1.1/ref/contrib/databrowse/
  30. 30. Pictures </li><ul><li>http://www.flickr.com/photos/stinajonsson/3932774410/
  31. 31. http://www.flickr.com/photos/daveknapik/3280194084/
  32. 32. http://www.flickr.com/photos/endlessstudio/3861211128/
  33. 33. http://press.absolut.com/
  34. 34. http://www.flickr.com/photos/oberazzi/318947873/ </li></ul></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×