remove wishlist as I am not planning to implement it for the first release
This commit is contained in:
parent
e4baa59f34
commit
8b38e16ea9
10 changed files with 0 additions and 121 deletions
|
@ -1,6 +0,0 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import Purchase, PurchaseTag
|
||||
|
||||
admin.site.register(Purchase)
|
||||
admin.site.register(PurchaseTag)
|
|
@ -1,6 +0,0 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class WishlistConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'wishlist'
|
|
@ -1,34 +0,0 @@
|
|||
# Generated by Django 3.2.16 on 2023-02-08 00:51
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('agent', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='PurchaseTag',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255)),
|
||||
('description', models.TextField(blank=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Purchase',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('comment', models.TextField(blank=True)),
|
||||
('title', models.CharField(max_length=255)),
|
||||
('author', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='agent.agent')),
|
||||
('tags', models.ManyToManyField(to='wishlist.PurchaseTag')),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -1,26 +0,0 @@
|
|||
from agent.models import Agent
|
||||
from django.db import models
|
||||
|
||||
|
||||
class PurchaseTag(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
description = models.TextField(blank=True)
|
||||
|
||||
def __repr__(self):
|
||||
return f"PurchaseTag_{self.name}"
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Purchase(models.Model):
|
||||
author = models.ForeignKey(Agent, on_delete=models.PROTECT)
|
||||
comment = models.TextField(blank=True)
|
||||
tags = models.ManyToManyField(PurchaseTag)
|
||||
title = models.CharField(max_length=255)
|
||||
|
||||
def __repr__(self):
|
||||
return f"Purchase_{self.title}"
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
|
@ -1,15 +0,0 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from .models import Purchase, PurchaseTag
|
||||
|
||||
|
||||
class PurchaseTagSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = PurchaseTag
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
class PurchaseSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Purchase
|
||||
fields = "__all__"
|
|
@ -1,3 +0,0 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
|
@ -1,14 +0,0 @@
|
|||
"""backend URL Configuration
|
||||
"""
|
||||
|
||||
from rest_framework import routers
|
||||
|
||||
from .views import PurchaseTagViewSet, PurchaseViewSet
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
|
||||
router.register(r"tag", PurchaseTagViewSet)
|
||||
router.register(r"purchase", PurchaseViewSet)
|
||||
|
||||
app_name = "wishlist-backend"
|
||||
urlpatterns = router.urls
|
|
@ -1,17 +0,0 @@
|
|||
from rest_framework import viewsets
|
||||
from rest_framework.permissions import IsAuthenticatedOrReadOnly
|
||||
|
||||
from .models import Purchase, PurchaseTag
|
||||
from .serializers import PurchaseSerializer, PurchaseTagSerializer
|
||||
|
||||
|
||||
class PurchaseTagViewSet(viewsets.ModelViewSet):
|
||||
queryset = PurchaseTag.objects.all()
|
||||
serializer_class = PurchaseTagSerializer
|
||||
permission_class = [IsAuthenticatedOrReadOnly]
|
||||
|
||||
|
||||
class PurchaseViewSet(viewsets.ModelViewSet):
|
||||
queryset = Purchase.objects.all()
|
||||
serializer_class = PurchaseSerializer
|
||||
permission_class = [IsAuthenticatedOrReadOnly]
|
Loading…
Reference in a new issue