Commit 90311357 by Tom Christie

Release notes

parent e8af73d1
...@@ -137,13 +137,13 @@ For instance, given the following example model: ...@@ -137,13 +137,13 @@ For instance, given the following example model:
rating = models.IntegerField() rating = models.IntegerField()
created_by = models.ForeignKey(User) created_by = models.ForeignKey(User)
Let's create a simple `ModelSerializer` class c. Let's create a simple `ModelSerializer` class corresponding to the `LocationRating` model.
class LocationRatingSerializer(serializer.ModelSerializer): class LocationRatingSerializer(serializer.ModelSerializer):
class Meta: class Meta:
model = LocationRating model = LocationRating
We can now inspect its representation in the Django shell, using `python manage.py shell`... We can now inspect the serializer representation in the Django shell, using `python manage.py shell`...
>>> serializer = LocationRatingSerializer() >>> serializer = LocationRatingSerializer()
>>> print(serializer) # Or use `print serializer` in Python 2.x >>> print(serializer) # Or use `print serializer` in Python 2.x
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment