Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: fix changelog link and sample examples. #700

Merged
merged 5 commits into from Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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/>`_