Skip to content

Commit

Permalink
Merge pull request #42 from bigpe/master
Browse files Browse the repository at this point in the history
fix: filter external modules && quote replace
  • Loading branch information
adenh93 committed May 24, 2023
2 parents 1823cc9 + d273803 commit 8751671
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion django_typomatic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ def __map_choices_to_enum_values(enum_name, field_type, choices):

choices_enum = f"export enum {enum_name} {{\n"
for key, value in choices.items():
value = value.replace("'", "\\'")
if type(value) == str:
value = value.replace("'", "\\'")
if type(key) == str:
choices_enum = choices_enum + f" {str(key).replace(' ', '_')} = '{value}',\n"
else:
Expand Down
2 changes: 1 addition & 1 deletion django_typomatic/management/commands/generate_ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def handle(self, *args, serializers, output, all, **options):
if all:
for app in apps.get_app_configs():
# Filter external modules
if str(settings.BASE_DIR.parent) not in app.path:
if str(settings.BASE_DIR.parent) not in app.path or '.venv' in app.path:
continue

serializers += self._get_app_serializers(app.name)
Expand Down

0 comments on commit 8751671

Please sign in to comment.