Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
C#
I am developing a site and its in test phase and I am new to django.So, My target is to make a site that has 5 users(just simple users with a radio button to select which is logged in), then a submit query box, that submit the users queries( I am naming then as goals, and initially I just have 5 goals).

So My aim is that user would submit a goal and the site should show back the similar goals based on the submitted goals and users with the similar goals.

Let's say user1 logged in and submit goal1, and then submit goal5 and for user2 he logged in and submit g1, g3, g4 etc. (all random), so the site should first make a co-relation matrix between users and goals and other matrix based on the previous matrix between the goals.

It's a bit hard to explain and I have created the model for it, but stuck after that. I need immediate help please.


What I have tried:

Here is how the model looks like:

from django.db import models

#Create your models here.

class Goals(models.Model):
goal_text = models.CharField(max_length=255) # now i can submit my goal_text in lower case here
hash = models.CharField()

def __unicode(self):
return self.goal_text

class Goals_log(models.Model):
goalsdev = models.ForeignKey(Goals)
user = models.CharField(max_length=32) #need to put placeholder in the form field time = models.DateTimeField('published date')

def __unicode(self):
return self.user

class Goalsco(models.Model):
goals_id_a = models.ManyToManyField(Goals)
goals_id_b = models.ManyToManyField(Goals) #this should have the many to many relationship with the user
count = models.IntegerField(default=0) #could also use AutoField for automatic increments.
Posted

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