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

Extend set of forbidden fields to include keywords from various database backends #13

Open
Cindy0113 opened this issue Nov 8, 2019 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Cindy0113
Copy link

Cindy0113 commented Nov 8, 2019

Issue location: /dynamic_models/models.py:254
That is:

class ModelFieldSchema(GenericModel, GenericField):
objects = ModelFieldSchemaManager()
null = models.BooleanField(default=False) # issue1
unique = models.BooleanField(default=False) # issue2
max_length = models.PositiveIntegerField(null=True)

Problem description:

'null' and 'unique' are keywords in mysql grammar.
In our strict DBA system, 'null' and 'unique' are forbidden to be column names.

Suggestion:
code to be modified as follows.

class ModelFieldSchema(GenericModel, GenericField):
objects = ModelFieldSchemaManager()
null = models.BooleanField(default=False, db_column='is_null') # issue1
unique = models.BooleanField(default=False, db_column='is_unique') # issue2
max_length = models.PositiveIntegerField(null=True)

@rvinzent rvinzent added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Nov 16, 2019
@rvinzent rvinzent added this to the 0.2.0 milestone Nov 16, 2019
@rvinzent rvinzent changed the title column name should not be 'null' or 'unique' Extend set of forbidden fields to include keywords from various database backends Nov 16, 2019
@rvinzent rvinzent added the 0.3.0 label May 17, 2020
@rvinzent rvinzent removed this from the 0.2.0 milestone May 17, 2020
@rvinzent rvinzent removed the 0.3.0 label Sep 21, 2020
@rvinzent
Copy link
Owner

@Cindy0113 Finally following up on this...

I was thinking about programmatically calling into Django's system checks framework to perform many other checks on model errors and warnings. Does this handle your use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants