Need help with Django models

I need a user foreign key inside a user model
It’s been giving me errors for hours now

We can’t really begin to guess what is wrong without seeing your code.

class User(AbstractBaseUser, PermissionsMixin):
   name = models.CharField(max_length=255, default='John Doe')
   sitter = models.ForeignKey(
   sitter_appointment = models.ManyToManyField(
   through_fields=('pet_sitter', 'pet_owner')

class Booking(models.Model):

 start_date = models.DateTimeField()  
 end_date = models.DateTimeField()
 owner_of_pet = models.ForeignKey(
     on_delete=models.CASCADE, blank=True,null=True)
 sitter = models.ForeignKey("User",related_name="sitter_bookings", on_delete=models.CASCADE)

class BookingSerializer(serializers.ModelSerializer):
   pet_sitter = UserReadSerializer()
   pet_owner = UserSerializer()
   class Meta:
       model = Booking
       fields = ('id','start_date', 'end_date', 'sitter', 'owner_of_pet','sitter_id')

I added the code.
Basically we wanted to create an appointment between a user which is the user that is signed in and another user in the database

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.