Skip to content

matej2/schema-to-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Schema-to-model

Genrates models based on Schema.org definitions.

The idea for an this app is that it would read pre-defined data structures (schema vocabularies) and generate models based on that. The best thing is that it would also generate all successors. For example: For Article it would generate Author, Category, Publisher... Maybe this app is not the best way to develop, but it is a way to kickstart it.

Technical details: Application will get schema information from schema.org. It will then use https://github.com/Abdenasser/dr_scaffold to generate objects. Later, I also plan to make generators for other languages

Instructions to use

On first run, execute Pipenv install

  1. Open main.py and edit origin_schema_name
  2. echo "python main.py" | pipenv shell
  3. Temp fix: cp test/migrations/__init__.py test/__init__.py && sed -i -r -e 's/(max_length=[0-9]+)\)/\1, null=True, blank=True)/g' test/models.py && sed -i -r -e 's/\((null=True)\)/(\1, blank=True)/g' test/models.py && sed -i -r -e 's/\(\)/(null=True, blank=True)/g' test/models.py
  4. echo "python manage.py makemigrations && python manage.py migrate" | pipenv shell
  5. (Optional) echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', '[email protected]', 'admin')" | python manage.py shell

About

Generates models based on Schema.org definitions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages