mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 05:04:31 +03:00
Release notes
This commit is contained in:
parent
e8af73d144
commit
90311357ad
|
@ -137,13 +137,13 @@ For instance, given the following example model:
|
|||
rating = models.IntegerField()
|
||||
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 Meta:
|
||||
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()
|
||||
>>> print(serializer) # Or use `print serializer` in Python 2.x
|
||||
|
|
Loading…
Reference in New Issue
Block a user