Ticket #23120: 23120.diff

File 23120.diff, 3.1 KB (added by Tim Graham, 10 years ago)
  • docs/ref/contrib/gis/tutorial.txt

    diff --git a/docs/ref/contrib/gis/tutorial.txt b/docs/ref/contrib/gis/tutorial.txt
    index 12c4768..bdcaae6 100644
    a b Run ``migrate``  
    265265---------------
    266266
    267267After defining your model, you need to sync it with the database. First,
    268 let's look at the SQL that will generate the table for the
    269 ``WorldBorder`` model::
     268create a database migration:
    270269
    271     $ python manage.py sqlall world
     270.. code-block:: bash
     271
     272    $ python manage.py makemigrations
     273    Migrations for 'world':
     274      0001_initial.py:
     275        - Create model WorldBorder
     276
     277Let's look at the SQL that will generate the table for the ``WorldBorder``
     278model:
     279
     280.. code-block:: bash
     281
     282    $ python manage.py sqlmigrate world 0001
    272283
    273284This command should produce the following output:
    274285
    275286.. code-block:: sql
    276287
    277     BEGIN;
    278288    CREATE TABLE "world_worldborder" (
    279289        "id" serial NOT NULL PRIMARY KEY,
    280290        "name" varchar(50) NOT NULL,
    This command should produce the following output:  
    292302    )
    293303    ;
    294304    CREATE INDEX "world_worldborder_mpoly_id" ON "world_worldborder" USING GIST ( "mpoly" );
    295     COMMIT;
    296305
    297306.. note::
    298307
    This command should produce the following output:  
    300309    column is added through a separate ``SELECT AddGeometryColumn(...)``
    301310    statement.
    302311
    303 If this looks correct, run :djadmin:`migrate` to create this table in the database::
     312If this looks correct, run :djadmin:`migrate` to create this table in the
     313database:
    304314
    305     $ python manage.py migrate
    306     Creating table world_worldborder
    307     Installing custom SQL for world.WorldBorder model
     315.. code-block:: bash
    308316
    309 The :djadmin:`migrate` command may also prompt you to create an admin user.
    310 Either do so now, or later by running ``django-admin.py createsuperuser``.
     317    $ python manage.py migrate
     318    Operations to perform:
     319      Apply all migrations: admin, world, contenttypes, auth, sessions
     320    Running migrations:
     321      ...
     322      Applying world.0001_initial... OK
    311323
    312324Importing Spatial Data
    313325======================
    Next, edit your ``urls.py`` in the ``geodjango`` application folder as follows::  
    737749        url(r'^admin/', include(admin.site.urls)),
    738750    ]
    739751
    740 Start up the Django development server:
     752Create an admin user:
     753
     754.. code-block:: bash
     755
     756    $ python manage.py createsuperuser
     757
     758Next, start up the Django development server:
    741759
    742760.. code-block:: bash
    743761
    744762    $ python manage.py runserver
    745763
    746 Finally, browse to ``http://localhost:8000/admin/``, and log in with the admin
    747 user created after running :djadmin:`migrate`. Browse to any of the ``WorldBorder``
    748 entries -- the borders may be edited by clicking on a polygon and dragging
    749 the vertexes to the desired position.
     764Finally, browse to ``http://localhost:8000/admin/``, and log in with the user
     765you just created. Browse to any of the ``WorldBorder`` entries -- the borders
     766may be edited by clicking on a polygon and dragging the vertexes to the desired
     767position.
    750768
    751769.. _OpenLayers: http://openlayers.org/
    752770.. _Open Street Map: http://www.openstreetmap.org/
Back to Top