1- Django Neomodel (beta!)
2- =======================
1+ # Django Neomodel (beta!)
32
4- .. image :: https://raw.githubusercontent.com/robinedwards/neomodel/master/doc/source/_static/neomodel-300.png
5- :alt: neomodel
3+ ![ neomodel] ( https://raw.githubusercontent.com/neo4j-contrib/neomodel/master/doc/source/_static/neomodel-300.png )
64
7- This module allows you to use the neo4j _ graph database with Django using neomodel _
5+ This module allows you to use the [ neo4j ] ( https://www.neo4j.org ) graph database with Django using [ neomodel ] ( http://neomodel.readthedocs.org )
86
9- .. _neo4j : https://www.neo4j.org
10- .. _neomodel : http://neomodel.readthedocs.org
117
12- Warnings
13- =======================
8+ ## Warnings
149
15- * Admin functionality is very experimental. ` Please see todos / issues here < https://github.com/neo4j-contrib/django-neomodel/projects/1 >`_
10+ * Admin functionality is very experimental. [ Please see todos / issues here] ( https://github.com/neo4j-contrib/django-neomodel/projects/1 )
1611
17- Live Examples (add yours here)
18- ===============================
12+ ## Live Examples (add yours here)
1913
20- * ` ResoTrack < https://resotrack.herokuapp. com/ >`_
14+ * [ Syracuse ] ( https://syracuse.1145.am> ) : a database of company linkages created from unstructured text. Repo at [ syracuse-neo ] ( https://github. com/alanbuxton/syracuse-neo.git )
2115
22- Getting started
23- ===============
16+ # Getting started
2417
25- Install the module::
18+ Install the module:
2619
2720 $ pip install django_neomodel
2821
29- Add the following settings to your `settings.py `::
22+ Add the following settings to your ` settings.py ` :
3023
3124 NEOMODEL_NEO4J_BOLT_URL = os.environ.get('NEO4J_BOLT_URL', 'bolt://neo4j:foobarbaz@localhost:7687')
3225
@@ -37,7 +30,7 @@ Add the following settings to your `settings.py`::
3730 'yourapp'
3831 )
3932
40- Write your first node definition in `yourapp/models.py `::
33+ Write your first node definition in ` yourapp/models.py ` :
4134
4235 from neomodel import StructuredNode, StringProperty, DateProperty
4336
@@ -46,18 +39,18 @@ Write your first node definition in `yourapp/models.py`::
4639 published = DateProperty()
4740
4841Create any constraints or indexes for your labels. This needs to be done after you change your node definitions
49- much like `manage.py migrate `::
42+ much like ` manage.py migrate ` :
5043
5144 $ python manage.py install_labels
5245
53- Now in a view `yourapp/views.py `::
46+ Now in a view ` yourapp/views.py ` :
5447
5548 from .models import Book
5649
5750 def get_books(request):
5851 return render('yourapp/books.html', request, {'books': Book.nodes.all()})
5952
60- In your `yourapp/admin.py `::
53+ In your ` yourapp/admin.py ` :
6154
6255 from django_neomodel import admin as neo_admin
6356 from .models import Book
@@ -68,10 +61,9 @@ In your `yourapp/admin.py`::
6861
6962And you're ready to go. Don't forget to check the neomodel_ documentation.
7063
71- Model forms
72- ===========
64+ ## Model forms
7365
74- Switch the base class from `StructuredNode ` to `DjangoNode ` and add a 'Meta' class::
66+ Switch the base class from ` StructuredNode ` to ` DjangoNode ` and add a 'Meta' class:
7567
7668 from datetime import datetime
7769 from django_neomodel import DjangoNode
@@ -90,7 +82,7 @@ Switch the base class from `StructuredNode` to `DjangoNode` and add a 'Meta' cla
9082 class Meta:
9183 app_label = 'library'
9284
93- Create a model form class for your `DjangoNode `::
85+ Create a model form class for your ` DjangoNode ` :
9486
9587 class BookForm(ModelForm):
9688 class Meta:
@@ -99,19 +91,17 @@ Create a model form class for your `DjangoNode`::
9991
10092This class may now be used just like any other Django form.
10193
102- Settings
103- ========
94+ ## Settings
10495The following config options are available in django settings (default values shown).
105- These are mapped to neomodel.config as django is started::
96+ These are mapped to neomodel.config as django is started:
10697
10798 NEOMODEL_NEO4J_BOLT_URL = 'bolt://neo4j:neo4j@localhost:7687'
10899 NEOMODEL_SIGNALS = True
109100 NEOMODEL_FORCE_TIMEZONE = False
110101 NEOMODEL_MAX_CONNECTION_POOL_SIZE = 50
111102
112- Signals
113- =======
114- Signals work with `DjangoNode ` sub-classes::
103+ ## Signals
104+ Signals work with ` DjangoNode ` sub-classes:
115105
116106 from django.db.models import signals
117107 from django_neomodel import DjangoNode
@@ -128,10 +118,9 @@ Signals work with `DjangoNode` sub-classes::
128118The following are supported: ` pre_save ` , ` post_save ` , ` pre_delete ` , ` post_delete ` .
129119On freshly created nodes ` created=True ` in the ` post_save ` signal argument.
130120
131- Testing
132- =======
121+ ## Testing
133122
134- You can create a setup method which clears the database before executing each test::
123+ You can create a setup method which clears the database before executing each test:
135124
136125 from neomodel import db, clear_neo4j_database
137126
@@ -142,14 +131,12 @@ You can create a setup method which clears the database before executing each te
142131 def test_something(self):
143132 pass
144133
145- Management Commands
146- ===================
134+ ## Management Commands
147135
148136The following django management commands have been included.
149137
150- install_labels
151- --------------
152- Setup constraints and indexes on labels for your node definitions. This should be executed after any schema changes::
138+ ### install_labels
139+ Setup constraints and indexes on labels for your node definitions. This should be executed after any schema changes:
153140
154141 $ python manage.py install_labels
155142 Setting up labels and constraints...
@@ -158,27 +145,19 @@ Setup constraints and indexes on labels for your node definitions. This should b
158145 + Creating unique constraint for title on label Book for class tests.someapp.models.Book
159146 Finished 1 class(es).
160147
161- clear_neo4j
162- -----------
148+ ### clear_neo4j
163149Delete all nodes in your database, warning there is no confirmation!
164150
165- Requirements
166- ============
151+ ## Requirements
167152
168- - Python 3.7 +
153+ - Python 3.8 +
169154- neo4j 5.x, 4.4 (LTS)
170155
171- .. image :: https://badges.gitter.im/Join%20Chat.svg
172- :alt: Join the chat at https://gitter.im/robinedwards/neomodel
173- :target: https://gitter.im/robinedwards/neomodel?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
174-
175- Docker Example
176- ===================
177-
156+ ## Docker Example
178157
179158Using Docker Compose.
180159
181- Commands to setup Docker Container docker-entrypoint.sh::
160+ Commands to setup Docker Container docker-entrypoint.sh:
182161
183162 # Go to tests
184163 $ cd tests/
@@ -191,12 +170,11 @@ Go to http://localhost:7474/browser/
191170Go to http://localhost:8000/admin/
192171
193172
194- Running Tests
195- ===================
173+ ## Running Tests
196174
197175Setup Neo4j Desktop with a local database with password 'foobarbaz' and version 5.x or 4.4.x (Neo4j LTS version).
198176
199- Commands to run tests::
177+ Commands to run tests:
200178
201179 # create local venv and install dependencies.
202180 $ pip install -e '.[dev]'; export DJANGO_SETTINGS_MODULE=tests.settings;
0 commit comments