imbibe master #2

Merged
pratyush merged 3 commits from devel into master 2022-01-08 05:33:23 +01:00
5 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ venv
.vscode .vscode
__pycache__ __pycache__
db.sqlite3 db.sqlite3
website/db.sqlite3

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -21,7 +21,7 @@ class Snippet(models.Model):
language = models.CharField(choices=LANGUAGE_CHOICES, default='python', max_length=100) language = models.CharField(choices=LANGUAGE_CHOICES, default='python', max_length=100)
style = models.CharField(choices=STYLE_CHOICES, default='friendly', max_length=100) style = models.CharField(choices=STYLE_CHOICES, default='friendly', max_length=100)
owner = models.ForeignKey('auth.user', related_name='snippets', on_delete=models.CASCADE) owner = models.ForeignKey('auth.user', related_name='snippets', on_delete=models.CASCADE)
highlighted = models.TextField highlighted = models.TextField()
class Meta: class Meta:
ordering = ['created'] ordering = ['created']

View File

@ -2,14 +2,13 @@ from django.contrib.auth.models import User
from .models import Snippet from .models import Snippet
from .serializers import SnippetSerializer, UserSerializer from .serializers import SnippetSerializer, UserSerializer
from .permissions import IsOwnerOrReadOnly from snippets.permissions import IsOwnerOrReadOnly
from rest_framework import permissions, renderers from rest_framework import permissions, renderers
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework.reverse import reverse from rest_framework.reverse import reverse
from rest_framework import viewsets from rest_framework import viewsets
from rest_framework.decorators import action from rest_framework.decorators import action
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework import permissions
class SnippetViewSet(viewsets.ModelViewSet): class SnippetViewSet(viewsets.ModelViewSet):
""" """