Skip to content

Instantly share code, notes, and snippets.

@login_required
def backgroundview(request):
if request.is_ajax():
form = BackgroundModelForm(request.POST, request.FILES)
if form.is_valid():
try:
g = BackgroundModel.objects.get(user=request.user)
except BackgroundModel.DoesNotExist:
data = form.save(commit=False)
data.user = request.user

Justification

Readers should be able to easily find the most recent content on our site. Readers should be able to do this on the main page, via a 'Latest' well that shows the 7 most recent stories. Readers should additionally be able to peruse all stories in reverse chronological order (much like the old site) on a separate 'Latest' page.

Requirements

  • Create a 'latest' queryset in apps/articles/querysets.py
  • Add a 'Latest' well entry in the admin (development, staging, and production)
  • Add the 'Latest' well to the 'Homepage' Page Ordering, ranking it right below the 'Trending' well
  • Add 'latest' as a type of query to SECTIONS
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@jnovinger
jnovinger / .tmux.conf
Last active August 29, 2015 13:57 — forked from alexyoung/tmux.conf
set -g status on
set -g status-utf8 on
set -g status-interval 2
set -g status-fg black
set -g status-bg colour232
set -g status-right '#[bg=colour233] #[fg=white,bg=colour234] %T #[fg=yellow,bg=colour233] #[bg=colour232] #(/Users/jason/bin/mac-battery.sh)'
set -g status-left '#[fg=colour16,bg=colour232,bold] #S #[fg=colour254,bg=colour234,nobold]'
set -g window-status-format "#[fg=colour16,bg=colour234] #I #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
set -g window-status-current-format "#[fg=colour117,bg=colour31] #I #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
set -g window-status-separator ""
@jnovinger
jnovinger / Contract Killer 3.md
Created January 18, 2016 19:15
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: October 8th 2015
  • Original post