mirror of
https://github.com/django-components/django-components.git
synced 2025-09-10 16:06:18 +00:00
feat: component URL (#1088)
* feat: allow to set defaults * refactor: remove input validation and link to it * feat: component URL * refactor: fix linter errors * refactor: fix linter errors + update examples to use Component.View..get * docs: update comment * refactor: revert change to hash_comp_cls * docs: update comment
This commit is contained in:
parent
3555411f1e
commit
a49f5e51dd
37 changed files with 987 additions and 314 deletions
|
@ -112,10 +112,11 @@ def is_nonempty_str(txt: Optional[str]) -> bool:
|
|||
return txt is not None and bool(txt.strip())
|
||||
|
||||
|
||||
# Convert Component class to something like `TableComp_a91d03`
|
||||
def hash_comp_cls(comp_cls: Type["Component"]) -> str:
|
||||
full_name = get_import_path(comp_cls)
|
||||
comp_cls_hash = md5(full_name.encode()).hexdigest()[0:6]
|
||||
return comp_cls.__name__ + "_" + comp_cls_hash
|
||||
name_hash = md5(full_name.encode()).hexdigest()[0:6]
|
||||
return comp_cls.__name__ + "_" + name_hash
|
||||
|
||||
|
||||
# String is a glob if it contains at least one of `?`, `*`, or `[`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue