- ISBN13: 978-1-4302-1047-4
- ISBN10: 1-4302-1047-8
- 320 pp.
- Published Dec 2008
- Print Book Price: $44.99
- eBook Price: $31.49
Errata Submission
If you think that you've found an error in Pro Django, please let us know about it. You will find any confirmed erratum below, so you can check if your concern has already been addressed.
Errata
| Issue | Author's Response |
|---|---|
| Chapter 5, pages 130 and 131. The listings on these pages include a line which reads: return http.HttpRedirect(form_hash) This is wrong, for two reasons: 1) there is no class or function called django.http.HttpRedirect (the correct name of the class is django.http.HttpResponseRedirect 2) the argument form_hash, by itself, makes no sense, as it is simply an MD5 hash, and not a URL that would be a suitable target for a redirect |
Both points are correct. The listings should include the following extra import at the beginning of the code: from django.core.urlresolvers import reverse Then, the redirect line should be replaced by the following two lines of code: path = reverse(make_offer, kwargs={'id': id, 'form_hash': form_hash}) return http.HttpResponseRedirect(path) |
| The code on page 256 does not appear to work. If it's updated to refer to save_model it works. I'm using my own example so it's possible your code works if transcribed verbatim. Here is my revised line which does work. super(ArticleAdmin,self).save_model(request,instance,form,change) |
Line 8 of the second code fragment on Page 256 should read: super(ImportantModelAdmin, self).save_model(request, instance, form, change) |
| Page 139: Missing quote sign in source code listing ">>> c['a'], c['b]" Page 150 Compiling to a Node: "within the jinja blog" should be "block" not "blog" |
Both of the replacements mentioned are correct. |
| Ch. 3, P. 96. Minor typo in the Articles class. In last line, s/mod0els/models/ | The last line of the second code fragment on Page 96 should read: get_absolute_url = models.permalink(get_absolute_url) |
| Ch. 3, P. 89. The two code fragments are duplicates. Looks like an accidental copy/paste error. | In this case, neither code fragment is incorrect (both will work just fine), but the difference between the two explanations is that the first fragment should read as follows: def create_model(name, module_path='django.db.models'): return ype(name, (models.Model,), {'__module__': module_path}) This essentially just adds a default value to module_path to ensure that it always gets a valid value, building on the fragment before it. The next fragment then adds in the attrs argument. |
| Chapter 2, Page 28, "Decorators", Code example The inner function wrapped (within def decorate) hast the arguments *args, **kwargs but returns *args, **kargs (w missing in**kwargs). |
Line 5 of the main code sample on Page 28 should read as follows: ... return func(*args, **kwargs) |
| On page 156 in the by_author() function there is self.filter(author=self, stats=self.model.EDITING) that should be self.filter(author=user) Filtering on a manager makes no sense. |
Line 12 on Page 156 should read as follows: return self.filter(author=user, status=self.model.EDITING) |
| Page 89, Options now correctly handles new styles classes. | Yes, Django 1.0 did resolve the issue with Options, so the workaround presented in the final paragraphs of Chapter 3 on Page 90 are no longer necessary. The inner Meta class (lines 5 through 7 of the code sample on Page 90) can instead be defined as follows: attrs['Meta'] = type('Meta', (), dict(meta_attrs, __module__=module_path)) |
