Настройка
- Джанго 2.0.2
- MariaDB 10,2
- Windows Server 2012
models.py
class Postreply(models.Model):
replyuid = models.BigAutoField(db_column='ReplyUID', primary_key=True)
postuid = models.BigIntegerField(db_column='PostUID')
useruid = models.BigIntegerField(db_column='UserUID')
content = models.TextField(db_column='Content')
registerdate = models.DateTimeField(
db_column='RegisterDate', default=datetime.datetime.today().strftime("%Y-%m-%dT%H:%M:%S"))
class Meta:
managed = False
db_table = 'postreply'
class Postinfo(models.Model):
postuid = models.BigAutoField(db_column='PostUID', primary_key=True)
useruid = models.BigIntegerField(db_column='UserUID')
content = models.TextField(db_column='Content')
replycount = models.IntegerField(db_column='ReplyCount', default=0)
registerdate = models.DateTimeField(
db_column='RegisterDate', default=datetime.datetime.today().strftime("%Y-%m-%dT%H:%M:%S"))
class Meta:
managed = False
db_table = 'postinfo'
class Userinfo(models.Model):
useruid = models.BigAutoField(db_column='UserUID', primary_key=True)
useremail = models.CharField(
db_column='UserEmail', unique=True, max_length=100)
userpassword = models.CharField(db_column='UserPassword', max_length=128)
passwordsalt = models.CharField(db_column='PasswordSalt', max_length=128)
usersex = models.IntegerField(db_column='UserSex')
userage = models.IntegerField(db_column='UserAge')
username = models.CharField(
db_column='UserName', max_length=100, default=0)
class Meta:
managed = False
db_table = 'userinfo'
Я хочу отфильтровать таблицу postreply
по полю postuid
, чтобы
и получите userinfo
экземпляр по useruid в рассылке после ответа
если postinfo ex)
postuid =3
exreply ex)
postuid = 3 useruid =21 replyuid= 1
postuid = 3 useruid =22 replyuid= 2
postuid = 3 useruid =21 replyuid= 3
postuid = 2 useruid =21 replyuid= 4
postuid = 3 useruid =33 replyuid= 5
userinfo ex)
useruid = 21 username = 'A'
useruid = 22 username = 'B'
useruid = 33 username = 'C'
если поставить postuid = 3, я хочу это
postuid = 3 useruid =21 replyuid= 1 username = 'A'
postuid = 3 useruid =22 replyuid= 2 username = 'B'
postuid = 3 useruid =21 replyuid= 3 username = 'A'
postuid = 3 useruid =33 replyuid= 5 username = 'C'
как к этому