fix_snippets #1

Merged
pratyush merged 2 commits from fix_snippets into devel 2022-01-08 05:31:39 +01:00
5 changed files with 6 additions and 5 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
venv
.vscode
__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)
style = models.CharField(choices=STYLE_CHOICES, default='friendly', max_length=100)
owner = models.ForeignKey('auth.user', related_name='snippets', on_delete=models.CASCADE)
highlighted = models.TextField
highlighted = models.TextField()
class Meta:
ordering = ['created']

View File

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