Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ManyToManyField의 사용 건. #1

Open
Yangyangii opened this issue Jul 1, 2015 · 0 comments
Open

ManyToManyField의 사용 건. #1

Yangyangii opened this issue Jul 1, 2015 · 0 comments

Comments

@Yangyangii
Copy link
Contributor

ManyToManyField의 사용 건.

현재 mycourse app 의 model이

class Recommend_Course(models.Model):
Course = models.ForeignKey(Course_Evaluation)
CreatedID = models.ForeignKey(Profile)

def __unicode__(self):
    return u'%s %s' % (self.Course.CourseName, self.CreatedID.UserName)

class Like_Course(models.Model):
Course = models.ForeignKey(Lecture)
CreatedID = models.ForeignKey(Profile)

def __unicode__(self):
    return u'%s %s' % (self.Course.CourseName, self.CreatedID.UserName)

이와 같이 되어있다. 그런데 Django의 특성상 ManyToManyField 를 사용하면 model 하나를 더 만들지 않아도 되고, 더 적은 조건으로 원하는 데이터를 조작할 수 있다.

login_profile table에서 ManyToManyField로 설계하도록 수정하는 것이 좋을 것 같다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant