Click here to Skip to main content
15,745,014 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am working in a small project using Angularjs and Django. I have two different models with its corresponding end points.

class Skills(models.Model):
    skills = models.CharField(max_length=100)

    def __str__(self):
        return self.skills

  class Project(models.Model):
    required_skills = models.ManyToManyField(
            Skills, verbose_name="list of skills")

This is a copy of my skills end point

        "id": 1,
        "skills": "Css"
        "id": 2,
        "skills": "HTML5"
        "id": 3,
        "skills": "Java"

On the front page I have a form that uses $ service to send data to the database. When I project is created, it might require one skill or multiple skills. Here is where my confusion come, I can store I foreign key by sending the pk which in this case is id. However, since I am dealing with a many to many relationship, I can not figure out what is the best way to proceed. I have read the documentation and some online resources with any success. Also, the form has an dropdown menu with the list of skills.I got this values using $http.get. Please anyone has any idea of how to solve this issue?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900