mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-23 02:51:09 -05:00
feat: Refactor rides app with unique constraints, mixins, and enhanced documentation
- Added migration to convert unique_together constraints to UniqueConstraint for RideModel. - Introduced RideFormMixin for handling entity suggestions in ride forms. - Created comprehensive code standards documentation outlining formatting, docstring requirements, complexity guidelines, and testing requirements. - Established error handling guidelines with a structured exception hierarchy and best practices for API and view error handling. - Documented view pattern guidelines, emphasizing the use of CBVs, FBVs, and ViewSets with examples. - Implemented a benchmarking script for query performance analysis and optimization. - Developed security documentation detailing measures, configurations, and a security checklist. - Compiled a database optimization guide covering indexing strategies, query optimization patterns, and computed fields.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
{% load widget_tweaks %}
|
||||
{% load widget_tweaks safe_html %}
|
||||
{# Security: Icon SVGs are sanitized to prevent XSS. Only trusted SVG elements are allowed. #}
|
||||
|
||||
{% if type == 'button' or type == 'submit' or type == 'reset' %}
|
||||
<button
|
||||
<button
|
||||
type="{{ type|default:'button' }}"
|
||||
{% if id %}id="{{ id }}"{% endif %}
|
||||
class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50
|
||||
class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50
|
||||
{% if variant == 'destructive' %}bg-destructive text-destructive-foreground hover:bg-destructive/90
|
||||
{% elif variant == 'outline' %}border border-input bg-background hover:bg-accent hover:text-accent-foreground
|
||||
{% elif variant == 'secondary' %}bg-secondary text-secondary-foreground hover:bg-secondary/80
|
||||
@@ -26,7 +27,7 @@
|
||||
{% if x_data %}x-data="{{ x_data }}"{% endif %}
|
||||
{% if x_on_click %}@click="{{ x_on_click }}"{% endif %}>
|
||||
{% if icon %}
|
||||
{{ icon|safe }}
|
||||
{{ icon|sanitize_svg }}
|
||||
{% if label %}<span class="ml-2">{{ label }}</span>{% endif %}
|
||||
{% else %}
|
||||
{{ label|default:content }}
|
||||
@@ -34,9 +35,9 @@
|
||||
{% block button_content %}{% endblock %}
|
||||
</button>
|
||||
{% else %}
|
||||
<a
|
||||
<a
|
||||
href="{{ href }}"
|
||||
class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50
|
||||
class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50
|
||||
{% if variant == 'destructive' %}bg-destructive text-destructive-foreground hover:bg-destructive/90
|
||||
{% elif variant == 'outline' %}border border-input bg-background hover:bg-accent hover:text-accent-foreground
|
||||
{% elif variant == 'secondary' %}bg-secondary text-secondary-foreground hover:bg-secondary/80
|
||||
@@ -51,7 +52,7 @@
|
||||
{% if x_data %}x-data="{{ x_data }}"{% endif %}
|
||||
{% if x_on_click %}@click="{{ x_on_click }}"{% endif %}>
|
||||
{% if icon %}
|
||||
{{ icon|safe }}
|
||||
{{ icon|sanitize_svg }}
|
||||
{% if label %}<span class="ml-2">{{ label }}</span>{% endif %}
|
||||
{% else %}
|
||||
{{ label|default:content }}
|
||||
|
||||
Reference in New Issue
Block a user