Skip to main content

Home/ interesting_sites/ Group items tagged advanced

Rss Feed Group items tagged

pagetribe .

XML for PHP developers, Part 2: Advanced XML parsing techniques - 0 views

  •  
    $xml = new SimpleXMLElement($xmlstr); foreach ($xml->book as $book) { echo $book->plot, '
    '; }
pagetribe .

Chapter 10: Advanced Models - 0 views

  • With ForeignKey fields, it works the other way, too, but it’s slightly different due to the non-symmetrical nature of the relationship. To get a list of books for a given publisher, use publisher.book_set.all(), like this:
  • Making Changes to a Database Schema
  • Run manage.py sqlall [yourapp]
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 .

Lifehacker - Top 10 Obscure Google Search Tricks - Feature - 0 views

  • Using a combination of advanced search operators that specify music files available in an Apache directory listing, you can turn Google into your personal Napster. Go ahead, try this search for Nirvana tracks: -inurl:(htm|html|php) intitle:"index of" +"last modified" +"parent directory" +description +size +(wma|mp3) "Nirvana". (Sub out Nirvana for the band you're interested in; use this one in conjunction with number 7 to find new music, too.) The same type of search recipe can find comic books as well.
1 - 6 of 6
Showing 20 items per page