Basic Crud In Django
by mcantelon on Oct 20, 2007
This presentation details how to do basic CRUD in Django.
This presentation details how to do basic CRUD in Django.
20 Embeds 889
| http://birtanyildiz.blogspot.com |
298 |
| http://cachina.wordpress.com |
220 |
| http://www.slideshare.net |
155 |
| http://log.7thpark.com |
66 |
| http://py-arahat.blogspot.com |
44 |
| http://blog.cachina.com.br |
40 |
| http://py.arahat.net |
35 |
| http://cachina.com.br |
9 |
| http://py-arahat.blogspot.com.es |
4 |
| http://makethepitch.tigerlab.com |
3 |
| http://www.rkblog.rk.edu.pl |
3 |
| http://translate.googleusercontent.com |
3 |
| http://www.python.rk.edu.pl |
2 |
| http://reader.youdao.com |
1 |
| http://www.google.com.tr |
1 |
| http://mj.limewebs.com |
1 |
| http://py-arahat.blogspot.mx |
1 |
| http://www.feedage.com |
1 |
| http://birtanyildiz.blogspot.com.au |
1 |
| http://py-arahat.blogspot.com.ar |
1 |
More...
Statistics
- Favorites
- 17
- Downloads
- 676
- Embed Views
- 889
- Views on SlideShare
- 28,351
- Total Views
- 29,240
1) in urls.py, you need a comma at the end of each line
2) the delete line causes a runtime error:
(r'^links/delete/(?P\d+)', 'diglic.links.views.delete'),
This would be a nice tutorial, but it really needs some cleanup work. 2 years ago Reply
1) when creating the models, the key name should be max_length not maxlength.
2) the edit method neglects to pass in the links variable, so it can't pre-populate the form. it should read as follows:
def edit(request, id):
link = Link.objects.get(id=id)
return render_to_response(
'links/form.html',
{'link' : link,
'action' : 'update/' + id,
'button' : 'Update'}
)
3) the ObjectPaginator has been renamed to Paginator in the most recent Django. To use it, you'll have to make the appropriate changes.
def list(request, page = 1, message = ''):
page = int(page)
link_list = Paginator(Link.objects.all(), 5)
p = link_list.page(page)
has_previous = p.has_previous()
has_next = p.has_next()
..... 2 years ago Reply
<b>[Comment posted from</b> http://log.7thpark.com/catalog.asp?tags=Django] 2 years ago Reply