Refactored Component class

# Conflicts:
#	README.md
#	pyproject.toml
This commit is contained in:
Emil Stenström 2021-09-10 11:27:28 +02:00
parent 55f46d6069
commit 5b9188cc9c
8 changed files with 91 additions and 111 deletions

View file

@ -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"]