Hi have been working with Django and i want to have relations bettwen model i have the following structure
on posts/models.py
from django.db import models
class Post(models.Model):
(SKIP ATTRIBUTES)
and then on comments/model.py
from django.db import models
from posts.models import Post
class Comment(models.Model):
post = models.ForeignKey(Post,on_delete=models.CASCADE,related_name='comments')
In a nutshell im trying to import posts model into comment model and i get the error that cannot import name 'Post' from 'posts.models , how should import posts model to avoid this issue ?
from posts.models import Post ImportError: cannot import name 'Post' from 'posts.models