Inspiration: http://creativecan.com/wp-content/uploads/2013/04/flat-blog-ui-kit-free-psd_thumb.jpg
A Pen by Josh Adamous on CodePen.
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] |
{% load pages_tags i18n mezzanine_tags %} | |
{% if page_branch_in_menu %} | |
{% if branch_level == 0 %} | |
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a> | |
<ul class="right hide-on-med-and-down"> | |
<li> <a class="modal-trigger" href="#searchbox"><i class="material-icons">search</i></a></li> | |
{% if user.is_authenticated %} | |
<li> <a href="{% url 'add_project' %}"><i class="material-icons">add</i></a></li> | |
{% endif %} |
#!/bin/bash | |
clear | |
cd /path/to your/virtual environment #path to your virtual environment | |
. bin/activate #Activate your virtual environment | |
cd /path/to your/project directory #After that go to your project directory | |
python manage.py runserver #run django server | |
After that save this file with .sh extension. I have saved this file as script.sh in the following example. | |
Run following command in terminal for giving execution permission to your script |
from django import forms | |
from django.contrib.auth.models import User | |
class UserProfileForm(forms.ModelForm): | |
class Meta: | |
model = User | |
fields = ['first_name', 'last_name', 'email'] | |
Forked from Katie Harron's Pen Simple ToDo app in Angularjs that saves to localstorage.
A Pen by Chris von Csefalvay on CodePen.
sudo ip -6 route del default | |
net.ipv6.conf.default.accept_ra_defrtr = 0 |
# templatetags/dataURI.py | |
from mimetypes import guess_type | |
from django import template | |
from base64 import b64encode | |
from django.contrib.staticfiles import finders | |
register = template.Library() |
# The problem: | |
# A user has to be able to submit a form only once per day | |
# The solution - my approach | |
# A hidden form (connected to a kinda Control Model) is embedded in the normal form the user submits. | |
# Hidden form when submitted, triggers a save on a model ForeignKey'ed | |
# to the request.user | |
# Upon re-rendering form, Control Model is checked. If an object exist relating to user in context, | |
# no form shows in template |
@classmethod | |
def get_total_hours(self): | |
'''Sum of all hours ever added''' | |
return GhanaECG.objects.all().aggregate(Sum('off_hours')) | |
@classmethod | |
def get_today_hours(self): | |
'''Sum of all hours submitted today''' | |
end_time = datetime.now() | |
start_time = datetime(end_time.year,end_time.month,end_time.day) |