This config sets up our Pi-Hole for the local network and the guest network while preserving proper host names in the query log.
See here for more context and other possible configuration.
- Internet > Zugangsdaten > DNS Server
DNSv4-Server
This config sets up our Pi-Hole for the local network and the guest network while preserving proper host names in the query log.
See here for more context and other possible configuration.
DNSv4-Server
Hopefully this will answer "How do I setup or start a Django project using REST Framework and ReactJS?"
This is a guide to show you step by step how this can be setup. If you just want to get started, use the cookiecuter I set up cookiecutter-django-reactjs. It basically is a fork of pydanny's cookiecutter, just added the front-end stuff :).
I created this because it was SUCH a pain in the ass setting up a project using all the latest technologies. After some research, I figured it out and have it working. The repo that implements this is located here. Feel free to use it as a boilerplate ;)
Main features:
import click | |
def prompt_proxy(ctx, param, use_proxy): | |
if use_proxy: | |
host = ctx.params.get('proxy_host') | |
if not host: | |
host = click.prompt('Proxy host', default='localhost') | |
port = ctx.params.get('proxy_port') |
from django.test import TestCase, RequestFactory | |
from django.utils.importlib import import_module | |
from django.contrib.auth import get_user_model | |
from django.core.urlresolvers import reverse | |
from django.contrib.sessions.middleware import SessionMiddleware | |
from django.contrib.messages.middleware import MessageMiddleware | |
from rest_framework import status | |
from .models import * |
from django import forms | |
from django.contrib.postgres.fields import ArrayField | |
class ChoiceArrayField(ArrayField): | |
""" | |
A field that allows us to store an array of choices. | |
Uses Django 1.9's postgres ArrayField | |
and a MultipleChoiceField for its formfield. |
# Tableau 20 Colors | |
tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120), | |
(44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150), | |
(148, 103, 189), (197, 176, 213), (140, 86, 75), (196, 156, 148), | |
(227, 119, 194), (247, 182, 210), (127, 127, 127), (199, 199, 199), | |
(188, 189, 34), (219, 219, 141), (23, 190, 207), (158, 218, 229)] | |
# Tableau Color Blind 10 | |
tableau20blind = [(0, 107, 164), (255, 128, 14), (171, 171, 171), (89, 89, 89), | |
(95, 158, 209), (200, 82, 0), (137, 137, 137), (163, 200, 236), |
To change a field name in django 1.7+ | |
1. Edit the field name in the model (but remember the old field name: you need it for step 3!) | |
2. Create an empty migration | |
$ python manage.py makemigrations --empty myApp | |
3. Edit the empty migration (it's in the migrations folder in your app folder, and will be the most recent migration) by adding | |
migrations.RenameField('MyModel', 'old_field_name', 'new_field_name'), | |
to the operations list. |
I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.