Skip to main content

Home/ Django/ Group items tagged examples

Rss Feed Group items tagged

pagetribe .

Integrate Web APIs into Your Django Site - Webmonkey - 0 views

  • Link.objects.get_or_create( url = info['href'], description = info['extended'], tags = info.get('tag', ''), date = parsedate(info['time']), title = info['description']
  • But we don't want to have to log in to the shell every time we want to update our displayed list of bookmarks. In fact, we want our site to automatically update itself. To do that, we're going to write a quick python script and then run it through a cron job.
  • problem
  • ...9 more annotations...
  • sync_link.py
  • Now worries though -- we just need to tell it about it.
  • create a new folder
  • name it "links."
  • class Link
  • "utils.py"
  • create a new file
  • links directory
  • utils.py
  •  
    Gives a good example of how to update a database via cron.
pagetribe .

Big list of Django tips (and some python tips too) | Surfing in Kansas - 0 views

  • Big list of Django tips
  • Writing managers is really simple, and they provide a better user interface to your code. This code snippet simply adds a latest() method to the default objects manager class ForecastDayManager(Manager): def __init__(self, *args, **kwargs): super(ForecastDayManager, self).__init__(*args, **kwargs) def latest(self): return self.get_query_set().order_by('forecast_date')[0] It can be called ForecastDay.objects.latest(). This is a trivial example, but there is a lot of power that lies in this functionality.
1 - 5 of 5
Showing 20 items per page