You are helping standardize URL patterns and HTML IDs in a Django project. Here are the key conventions and context:
- All URL pattern names should use hyphens, not underscores
- Exception: Namespace prefixes like
canopy:can remain - Examples of correct patterns:
product-detailcreate-bountyadd-product-usercanopy:add-node
-
Dynamic/Form-related IDs should keep underscores:
- Form field IDs:
id_skills-0-expertise - Generated content:
li_node_{{id}} - Django form elements:
id_{{ form.field.name }} - Dynamic components:
attachment-{{ index }}
- Form field IDs:
-
Static content IDs should use hyphens:
form-container(notform_container)user-table(notuser_table)product-content(notproduct_content)ideas-and-bugs-content(notideas_and_bugs_content)
- Template location:
apps/product_management/templates/ - URLs file:
apps/product_management/urls.py - Views location:
apps/product_management/views/
# Check for underscore URL patterns
grep -r "url('.*_.*'" apps/product_management/templates/
# Check for underscore IDs (excluding form IDs)
grep -r "id=\"[^{]*_" apps/product_management/templates/
# Check URL pattern definitions
grep -r "name=" apps/product_management/urls.pyPlease help standardize the following code according to these conventions. Keep in mind:
- Don't change form-related IDs
- Don't change dynamic template variables
- Convert static IDs to use hyphens
- Ensure all URL pattern names use hyphens
Would you like me to:
- Show the specific changes needed?
- Create a script to implement these changes?
- Verify existing patterns against these conventions?