This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from django.contrib.auth.admin import UserAdmin | |
from django.utils.translation import ugettext_lazy as _ | |
from .forms import UserChangeForm, UserCreationForm | |
from .models import User |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django import forms | |
class TextInputTextField(models.TextField): | |
def formfield(self, **kwargs): | |
kwargs.update({ | |
"widget": forms.TextInput | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser(description='Replace text nodes') | |
parser.add_argument('file', type=str) | |
args = parser.parse_args() | |
html = open(args.file).read() | |
def replace(content): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deep_get(dictionary, keys, default=None): | |
""" | |
Gets a value following the specified path, if it exists. | |
The keys are dot-separated. | |
Example: | |
deep_get({'most_visited': {'url': 'https://test.com/'}}, 'most_visited.url') | |
""" |
OlderNewer