mirror of
https://github.com/django-components/django-components.git
synced 2025-10-14 15:59:00 +00:00
Refactored Component class
# Conflicts: # README.md # pyproject.toml
This commit is contained in:
parent
55f46d6069
commit
5b9188cc9c
8 changed files with 91 additions and 111 deletions
|
@ -9,11 +9,7 @@ from .testutils import create_and_process_template_response, Django30CompatibleS
|
|||
|
||||
|
||||
class SimpleComponentAlternate(component.Component):
|
||||
def context(self, variable):
|
||||
return {}
|
||||
|
||||
def template(self, context):
|
||||
return "simple_template.html"
|
||||
template_name = "simple_template.html"
|
||||
|
||||
class Media:
|
||||
css = "style2.css"
|
||||
|
@ -21,23 +17,21 @@ class SimpleComponentAlternate(component.Component):
|
|||
|
||||
|
||||
class SimpleComponentWithSharedDependency(component.Component):
|
||||
template_name = "simple_template.html"
|
||||
|
||||
def context(self, variable, variable2="default"):
|
||||
return {
|
||||
"variable": variable,
|
||||
"variable2": variable2,
|
||||
}
|
||||
|
||||
def template(self, context):
|
||||
return "simple_template.html"
|
||||
|
||||
class Media:
|
||||
css = ["style.css", "style2.css"]
|
||||
js = ["script.js", "script2.js"]
|
||||
|
||||
|
||||
class MultistyleComponent(component.Component):
|
||||
def template(self, context):
|
||||
return "simple_template.html"
|
||||
template_name = "simple_template.html"
|
||||
|
||||
class Media:
|
||||
css = ["style.css", "style2.css"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue