CCCPaste

How to split into two models from Chat gpt

СТРАННО НЕ ВИЖДАМ DELETE PLACE. МОЖЕ БИ СЪМ ГО ЗАБРАВИЛ!!!!!!!!!

from django.contrib.auth import get_user_model
from django.db import models

UserModel = get_user_model()

class Category(models.Model):
    CATEGORY_CHOICES = [
        ('Mountain', 'Mountain'),
        ('Sea', 'Sea'),
        ('Historical Site', 'Historical Site'),
        ('City', 'City'),
        ('Spa', 'Spa'),
        ('Wine Tourism', 'Wine Tourism')
    ]

    category = models.CharField(max_length=100, choices=CATEGORY_CHOICES)

    def __str__(self):
        return self.category

class Place(models.Model):
    RATING_CHOICES = [
        (1, '1 Star'),
        (2, '2 Stars'),
        (3, '3 Stars'),
        (4, '4 Stars'),
        (5, '5 Stars'),
    ]

    hotel_name = models.CharField(
        max_length=200,
        null=False,
        blank=False,
        verbose_name="Hotel name",
    )
    description = models.TextField(
        null=False,
        blank=False,
    )
    location = models.CharField(
        max_length=200,
        null=False,
        blank=False,
    )
    rating = models.IntegerField(
        choices=RATING_CHOICES,
        null=True,
        blank=True,
    )

    image_url = models.ImageField(upload_to="mediafiles/photos", null=True, blank=True,)

    category = models.ForeignKey(Category, on_delete=models.CASCADE)

    user = models.ForeignKey(UserModel, on_delete=models.CASCADE)

from django import forms
from my_holiday.destination.models import Place, Category

class PlaceBaseForm(forms.ModelForm):
    class Meta:
        model = Place
        fields = ['hotel_name', 'description', 'location', 'rating', 'image_url', 'category']
        widgets = {
            'hotel_name': forms.TextInput(attrs={'placeholder': 'Enter hotel name...'}),
            'description': forms.Textarea(attrs={'placeholder': 'Enter short hotel description...'}),
            'location': forms.TextInput(attrs={'placeholder': 'Fill hotel location...'}),
        }

class PlaceCreateForm(PlaceBaseForm):
    CATEGORY_CHOICES = Category.CATEGORY_CHOICES
    category = forms.ChoiceField(choices=CATEGORY_CHOICES)

class PlaceDetailsForm(PlaceBaseForm):
    pass

class PlaceEditForm(PlaceBaseForm):
    pass