jeudi 13 mars 2014

django - how to design apps that share models?


Vote count:

0




I am designing a web application that has user SignUps and Posts related to them. Each User will signUp for an account using his email credentials, that will be followed by authentication email to confirm. Once confirmed, the user accounts becomes active. Each user will have his 'blog like area` where he can choose a category and add contents about it. This will be displayed to other users who have subscribed for that category.


I am having difficulty in coming up with a design statergy to make this work and has capabilities to extend futher in case needed. ( I dont want to hard code things and no coupling between models but at the same time relation between models be maintained)


In the SignUp App, I will have User Credentials along with which I will have a Field for the mypost



signups/models.py:

from django.db import models
from postblog import post

Class SignUp(models.Model):
Username=models.CharField(max_length=200)
email=models.EmailField(unique=true,null=false)
mypost=models.ForeignKey('post')

postblog/models.py:

from django.db import models
from signups import SignUp

Class postblog(models.Model):
post=models.TextField(blank=True)
category=models.CharField(max_length=50,choices=BEER_CHOICES)
TimeStamp=...
TimeUpdated=

Class Comment(models.Model):
comments=models.TextField(blank=True)
author=models.ForeignKey('SignUp')
TimeStamp=...
TimeUpdated=...


please help with overall design procedure. Thanks



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire