Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any adequate scaffolding for Django? (à la Ruby on Rails)

Is there any adequate scaffolding for Django?

It may be in the newly released 1.3 version, but I haven't found it yet.

like image 302
sultan Avatar asked Mar 23 '11 14:03

sultan


People also ask

Does Django have scaffolding?

Django-Scaffolding creates pseudo-real-world placeholder data for your app. Data can be any type like names, cities, images and instances of your models. It's not a mocking framework, it creates real django model instances.

How do I make scaffolding in Rails?

To generate a fully working scaffold for a new object, including model, controller, views, assets, and tests, use the rails g scaffold command. Then you can run rake db:migrate to set up the database table. Then you can visit http://localhost:3000/widgets and you'll see a fully functional CRUD scaffold.

What is Ruby scaffold?

Scaffolding in Ruby on Rails refers to the auto-generation of a set of a model, views and a controller usually used for a single database table.

What does scaffolding do in Rails?

Rails scaffolding is a quick way to generate some of the major pieces of an application. If you want to create the models, views, and controllers for a new resource in a single operation, scaffolding is the tool for the job.


1 Answers

I've looked and not yet found something for Django quite like the Rails Generate command. Django has a bit of a different philosophy. It gives you tools to make doing things easily but doesn't actually do it for you (except the admin interface). In the grand scheme of things, I think this is OK. When I use rails' scaffolding I'm not able to often keep much of the auto-generated stuff. When I do, the django admin interface would probably also have worked and given me more functionality.

Instead, what I suggest is reading through the Django tutorial step 4, which introduces generic views, and then chapter 7 of the Django book which introduces forms. You have to be patient on chapter 7 because the authors think you want to know the minute details of the hard-way before they teach you the easy way. (try searching the page for the phrase django.forms)

In the end the amount of work you have to do between rails and django is equivalent, and maybe slightly less with Django. However you don't have one command to automatically give you boilerplate code to use as a foundation.

like image 151
newz2000 Avatar answered Sep 27 '22 15:09

newz2000