Skip to main content

Home/ interesting_sites/ Group items tagged views

Rss Feed Group items tagged

pagetribe .

Chapter 8: Advanced Views and URLconfs - 0 views

  • Here, each view starts by checking that request.user is authenticated — that is, the current user has successfully logged into the site — and redirects to /accounts/login/ if not.
  • It would be nice if we could remove that bit of repetitive code from each of these views and just mark them as requiring authentication.
  • Now, we can remove the if not request.user.is_authenticated() checks from our views and simply wrap them with requires_login in our URLconf:
  • ...3 more annotations...
  • This has the same effect as before, but with less code redundancy. Now we’ve created a nice, generic function — requires_login() that we can wrap around any view in order to make it require login.
  • making a view wrapper.
  • There’s an important gotcha here: the regular expressions in this example that point to an include() do not have a $ (end-of-string match character) but do include a trailing slash.
  •  
    Here, each view starts by checking that request.user is authenticated - that is, the current user has successfully logged into the site - and redirects to /accounts/login/ if not.
pagetribe .

Chapter 11: Generic Views - 0 views

  • from django.conf.urls.defaults import * from django.views.generic import list_detail from mysite.books.models import Publisher publisher_info = { 'queryset': Publisher.objects.all(), 'template_name': 'publisher_list_page.html', } urlpatterns = patterns('', (r'^publishers/$', list_detail.object_list, publisher_info) )
  • That’s really all there is to it. All the cool features of generic views come from changing the “info” dictionary passed to the generic view.
  • You might have noticed that sample publisher list template stores all the books in a variable named object_list.
  • ...10 more annotations...
  • it isn’t all that “friendly” to template authors: they have to “just know” that they’re dealing with books here.
  • better name
  • publisher_list;
  • 'template_object_name': 'publisher',
  • If you want to present a list of books by a particular publisher, you can use the same technique:
  • Another common need is to filter the objects given in a list page by some key in the URL. Earlier we hard-coded the publisher’s name in the URLconf, but what if we wanted to write a view that displayed all the books by some arbitrary publisher?
  • “wrap” the object_list generic view
  • # Look up the publisher (and raise a 404 if it can't be found). publisher = get_object_or_404(Publisher, name__iexact=name)
  • Notice that in the preceding example we passed the current publisher being displayed in the extra_context. This is usually a good idea in wrappers of this nature; it lets the template know which “parent” object is currently being browsed.
  • Or, you could use a less obvious but shorter version that relies on the fact that Book.objects.all is itself a callable:
pagetribe .

thinkfree view - 0 views

  • ThinkFree Viewers allow web bloggers, designers, and application developers access to use our Publisher, API's, and WordPress Plug-in to link live documents from their own sites.
  • Users can view ThinkFree or Microsoft Office word processing, spreadsheet, and presentation files without having any other office applications installed.
  •  
    View MSoffice online without MSO. Displays document in javascript window.
pagetribe .

Chapter 3: Views and URLconfs - 0 views

  • Now that we’ve designated a wildcard for the URL, we need a way of passing that wildcard data to the view function, so that we can use a single view function for any arbitrary hour offset. We do this by placing parentheses around the data in the URLpattern that we want to save.
  • we’re using parentheses to capture data from the matched text.
  •  
    *
pagetribe .

PHP XML Expat Parser - 0 views

  • Event-based parser: Views an XML document as a series of events. When a specific event occurs, it calls a function to handle it The Expat parser is an event-based parser. Event-based parsers focus on the content of the XML documents, not their structure. Because of this, event-based parsers can access data faster than tree-based parsers.
  •  
    Event-based parser: Views an XML document as a series of events. When a specific event occurs, it calls a function to handle it
pagetribe .

Beginners guide in Virtual Hosts on Apache - Online Training and Tutorials - 0 views

  • /etc/httpd/conf/httpd.conf).
  • httpd.conf file
pagetribe .

A tour of git: the basics - 0 views

shared by pagetribe . on 19 Feb 09 - Cached
  • ~ suffix
  • HEAD~
  • HEAD~2" refers to two commits back
  • ...19 more annotations...
  • refers to the previous commit
  • $ git log HEAD~3..
  • git show 13ed136b
  • git status" tells us that the current branch is "master"
  • It’s a little bit helpful to know that we’ve modified hello.c, but we might prefer to know exactly what changes we’ve made to it.
  • git diff
  • To set your name and email address, just use the following commands:
  • git config --global user.name "Your Name" git config --global user.email "you@example.com"
  • --author option to the “git commit”
  • a blank line, and then one or more paragraphs with supporting detail. Since many tools only print the first line of a commit message by default, it’s important that the first line stands alone.
  • git commit --amend
  • misspelling in it
  • It's worth emphasizing the value of minimal, independent commits. The smaller the changes are the more useful the history will be when actually using the history, not just viewing it.
  • Just run "git pull" everytime you want to pull in new changes that have landed in the upstream repository.
  • Again, you'll see that this precisely matches the final portion of the output from "git pull". Using "git fetch" and "git merge" let us achieve exactly what "git pull" did, but we were able to stop in the middle to examine the situation, (and we could have decided to reject the changes and not merge them---leaving our master branch unchanged).
  • For now, let's return back to the tip of the master branch by just checking it out again: $ git checkout master
  • $ git --bare init --shared The --shared option sets up the necessary group file permissions so that other users in my group will be able to push into this repository as well.
  • Now, generally the purpose of pushing to a repository is to have some "collaboration point" where potentially multiple people might be pushing or pulling.
  • git clone
1 - 10 of 10
Showing 20 items per page