Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect object_types #13

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions djlsp/scripts/django-collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ def get_file_watcher_globs():
return patterns


def get_object_types():
models = apps.get_models()
object_types = {}
for model in models:
model_path = model.__module__ + "." + model.__name__
object_types[model_path] = {field.name: None for field in model._meta.fields}
return object_types


def get_static_files():
# TODO: Add option to ignore some static folders
# (like static that is generated with a JS bundler)
Expand Down Expand Up @@ -282,6 +291,7 @@ def collect_project_data():
"urls": get_urls(),
"libraries": get_libraries(),
"templates": get_templates(),
"object_types": get_object_types(),
}


Expand Down