Thursday, June 30, 2016

Re: "canonical" views.py in Django Unleashed book, Chapter 22

Hi Malik!
Thanks for buying my book! I'm glad to hear you like Django Unleashed, but I'm sorry you're frustrated with the github repo at https://github.com/jambonrose/DjangoUnleashed-1.8 .

Page xiv provides a quick explanation of git commits' relationship to the examples in the book. In short: each example in the book has a corresponding commit in the github repo (1+ examples per commit). This is why each example lists 'filename in hash' at the top of the example. If you suffix http://dju.link/ with a commit, it will take you to the diff on github.

For instance, in example 22.13 (which you referenced), the example is listed as being 'user/views.py in 83167965e8'. You can browse to http://dju.link/83167965e8 to be redirected to the diff of that commit on github, or else to http://dju.link/83167965e8/user/views.py to see the state of the file at that commit.

NB: if you browse the code on github without adjusting the commit, you're seeing the code as it is in Chapter 29 (Chapter 30 has no code in the repo).

If you don't want to browse github, you can also clone the repo, checkout commit 83167965e8, and then have the project to run directly on your computer!

Note that each commit message is prefixed with the Chapter that references it (such as 'Ch22: Create Profile Update web page.'). What's more, the sample gitconfig file in the repo comes with a few neat commands to make moving around the repo easier. See https://github.com/jambonrose/DjangoUnleashed-1.8#walking-the-repository for more info.

Now, to address some of your points directly:

> There is no core.utils or UpdateView in the github version

https://github.com/jambonrose/DjangoUnleashed-1.8/blob/master/core/utils.py#L5

> There is no PublicProfileDetail in the github version

http://dju.link/a1d420b17a
->
https://github.com/jambonrose/DjangoUnleashed-1.8/commit/a1d420b17a/

You can then browse to:
https://github.com/jambonrose/DjangoUnleashed-1.8/blob/a1d420b17a/user/views.py#L134

> Again, there is no PublicProfileDetail in the github version, which stops at line 111

http://dju.link/a1d420b17a/user/urls.py
->
https://github.com/jambonrose/DjangoUnleashed-1.8/blob/a1d420b17a/user/urls.py

Relevant line is 114:
https://github.com/jambonrose/DjangoUnleashed-1.8/blob/a1d420b17a/user/urls.py#L114

I'm not super sure what you were looking at, or where the confusion occurred, but I would be open to your feedback about what you were seeing and how you got there, so that I may help others better get the code examples (as I spent *a lot* of time making the repo as cleans as possible given my deadlines).

Hope that's helpful,
Andrew

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/86CD3FC7-D9F3-4705-9410-6275E6C93907%40andrewsforge.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment