Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

KhoPhi seanmavley

🏠
Working from home
View GitHub Profile
@seanmavley
seanmavley / enable_mongo.sh
Created Jan 23, 2016 — forked from sgnn7/enable_mongo.sh
Mongodb 3.2 on Ubuntu 15.10
View enable_mongo.sh
echo '[Unit]
Description=High-performance, schema-free document-oriented database
After=syslog.target network.target
[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongod -f /etc/mongod.conf
[Install]
View admin.py
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
# Note: we are renaming the original Admin and Form as we import them!
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld
from django import forms
from ckeditor.widgets import CKEditorWidget
View fields.py
from django import forms
# import models here from django and subclass
from django.db import models
from django.template.defaultfilters import filesizeformat
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
class RestrictedFileFieldModel(models.FileField):
def __init__(self, *args, **kwargs):
self.content_types = kwargs.pop('content_types', None)