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 utils import get_modelform_fields | |
| from myapp.forms import MyModelForm | |
| print(get_modelform_fields(MyModelForm)) |
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 time | |
| from functools import wraps | |
| import logging | |
| import inspect | |
| from django.conf import settings | |
| SHOULD_LOG_PERFORMANCE = getattr(settings, "SHOULD_LOG_PERFORMANCE", False) | |
| PERFORMANCE_LOGGER_NAME = "django.performance" | |
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.core.management.base import BaseCommand | |
| class Command(BaseCommand): | |
| help = "Downloads the latest stable ChromeDriver" | |
| JSON_URL = "https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json" | |
| def get_platform(self): | |
| import sys |
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 os | |
| import json | |
| from django.core.exceptions import ImproperlyConfigured | |
| with open(os.path.join(os.path.dirname(__file__), "secrets.json"), "r") as f: | |
| secrets = json.loads(f.read()) | |
| def get_secret(setting): |
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
| <div class="form-field"> | |
| <label for="title">Title</label> | |
| <input type="text" id="title" /> | |
| <button type="button" | |
| class="reset_field" | |
| data-url="http://example.com/default-title/" | |
| data-target="#title" | |
| >Reset title</button> | |
| </div> |
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 functools import wraps | |
| from inspect import getfullargspec, unwrap | |
| from django import template | |
| register = template.Library() | |
| def dynamic_inclusion_tag(filename=None, func=None, takes_context=None, name=None): | |
| """ |
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 re | |
| from django.core.exceptions import ValidationError | |
| def validate_css_color(value): | |
| """ | |
| Custom validation function for background color field. | |
| Args: | |
| value (str): The value entered for the background color field. |
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
| {% load i18n %} | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title> | |
| {% block head_title %} | |
| {% endblock head_title %} | |
| </title> |
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
| #!/usr/bin/env bash | |
| CURRENT_DIR=$(dirname "$0") | |
| BASE_DIR=$CURRENT_DIR/../../.. | |
| # Define output filename | |
| OUTPUT_FILE="$BASE_DIR/site_static/site/js/combined.js" | |
| echo "" > $OUTPUT_FILE |
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
| {% load query_params_tags %} | |
| <div class="grid md:grid-cols-12 grid-cols-1 mt-8"> | |
| <div class="md:col-span-12 text-center"> | |
| <nav aria-label="Page navigation example"> | |
| <ul class="inline-flex items-center -space-x-px"> | |
| {% if page_obj.has_previous %} | |
| <li><a href="{% modify_query page=page_obj.previous_page_number %}" class="size-[40px] inline-flex justify-center items-center text-slate-400 bg-white dark:bg-slate-900 rounded-s-3xl hover:text-white border border-gray-100 dark:border-gray-800 hover:border-sky-600 dark:hover:border-sky-600 hover:bg-sky-600 dark:hover:bg-sky-600"><i class="uil uil-angle-left text-[20px] rtl:rotate-180 rtl:-mt-1"></i></a></li> | |
| {% if page_obj.number > 3 %} | |
| <li><a href="{% modify_query page=1 %}" class="size-[40px] inline-flex justify-center items-center text-slate-400 hover:text-white bg-white dark:bg-slate-900 border border-gray-100 dark:border-gray-800 hover:border-sky-600 dark:hove |