Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Docs: fix changelog link and sample examples. (#700)
* docs: update docs to show decimal field support and check constraints but no support for unsigned data type

* docs: linked changelog correctly

* docs: fix doc links for sample examples

* fix: skip test cursor_executemany_with_empty_params_list as spanner support is not there
  • Loading branch information
vi3k6i5 committed Aug 19, 2021
1 parent ed404f5 commit 08b80ce
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
2 changes: 2 additions & 0 deletions django_spanner/features.py
Expand Up @@ -38,6 +38,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
skip_tests = (
# No foreign key constraints in Spanner.
"backends.tests.FkConstraintsTests.test_check_constraints",
# Spanner does not support empty list of DML statement.
"backends.tests.BackendTestCase.test_cursor_executemany_with_empty_params_list",
"fixtures_regress.tests.TestFixtures.test_loaddata_raises_error_when_fixture_has_invalid_foreign_key",
# No Django transaction management in Spanner.
"basic.tests.SelectOnSaveTests.test_select_on_save_lying_update",
Expand Down
1 change: 0 additions & 1 deletion docs/changelog.md

This file was deleted.

1 change: 1 addition & 0 deletions docs/changelog.md
1 change: 1 addition & 0 deletions docs/example_from_scratch.md
1 change: 1 addition & 0 deletions docs/example_healthchecks.md
30 changes: 9 additions & 21 deletions docs/samples.rst
@@ -1,24 +1,12 @@
Sample Code
####################################
Sample Examples
###############

Create and register your first model
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To define your database layout create a models file in your app folder and add the relevant
classes to it. Spanner works exactly like any other database you may have used with Django.
Here is a simple example you can run with Spanner. In our poll application below we create
the following two models:
django-spanner for Django tutorial
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python
This `Example <example_from_scratch.html>`_ shows how to use django-spanner for Cloud Spanner as a backend database for `healthchecks.io <https://healthchecks.io>`_

from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return str(self.rating)
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
django-spanner on healthchecks.io
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This `Example <example_healthchecks.html>`_ shows how to use django-spanner for Cloud Spanner as a backend database for `Django's tutorials <https://docs.djangoproject.com/en/2.2/intro/tutorial01/>`_

0 comments on commit 08b80ce

Please sign in to comment.