Skip to content

Instantly share code, notes, and snippets.

View rmoch's full-sized avatar

Richard Moch rmoch

  • France Université Numérique
  • Paris
View GitHub Profile
@aaugustin
aaugustin / admin.py
Last active August 7, 2022 19:39
Read-only ModelAdmin for Django
from django.contrib import admin
class ReadOnlyModelAdmin(admin.ModelAdmin):
"""
ModelAdmin class that prevents modifications through the admin.
The changelist and the detail view work, but a 403 is returned
if one actually tries to edit an object.
@mike3k
mike3k / gist:6125852
Created July 31, 2013 20:30
Use this as a custom action in SourceTree to view the selected commit on Github. In the custom action editor, specify the parameters $REPO $SHA
#!/bin/sh
cd $1
URL=`git remote -v |grep "fetch)" |awk '{print $2;}'|sed -e's#[email protected]:#http://github.com/#'|sed -e's|\.git||'`
open ${URL}/commit/$2