Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create views automatically from model as in Django admin?

I'm starting to use Django and I'm really impressed by the possibility of automatically creating views from a model. So, I'd like to know if there is such functionality on other web frameworks. I know of RoR scaffolding, but that is not quite the same thing, since you need to change your views manually in case you change the related model.

like image 533
andrers52 Avatar asked Oct 27 '25 02:10

andrers52


2 Answers

For those who are looking for an answer here, perhaps django-baker (https://github.com/krisfields/django-baker.git) will do what you need.

pip install django-baker

Then add django_baker to INSTALLED_APPS and run

python manage.py bake your_app_name

Note that previously you need to remove urls.py and views.py from your app so they can be generated.

Then it will generate all the skeleton stuff.

like image 165
Martin0x777 Avatar answered Oct 28 '25 18:10

Martin0x777


https://docs.djangoproject.com/en/dev/topics/class-based-views/

like image 35
Gerard Avatar answered Oct 28 '25 17:10

Gerard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!