from django.db import models
from django.contrib.auth.models import User
from django.db.models import Sum


class Group(models.Model):
    name = models.CharField('Название', max_length=100)

    def __str__(self):
        return self.name

    class Meta:
        verbose_name = 'Группа'
        verbose_name_plural = 'Группы'


class UserProfile(models.Model):
    user = models.OneToOneField(User)
    about = models.TextField('О себе', blank=True)
    group = models.ForeignKey(Group, verbose_name='Группа')

    def earned(self):
        return self.user.transactions_from.aggregate(Sum('amount'))['amount__sum']

    def spend(self):
        return self.user.transactions_to.aggregate(Sum('amount'))['amount__sum']

    def balance(self):
        try:
            return self.earned() - self.spend()
        except:
            return 0

    def __str__(self):
        s = self.user.first_name + ' ' + self.user.last_name
        s = self.user.username if s == ' ' else s
        return s

    class Meta:
        verbose_name = 'Профиль пользователя'
        verbose_name_plural = 'Профили пользователей'


class Transaction(models.Model):
    user_from = models.ForeignKey(User, verbose_name='От кого', related_name='transactions_from')
    user_to = models.ForeignKey(User, verbose_name='Кому', related_name='transactions_to')
    description = models.CharField('Описание', max_length=500)
    amount = models.FloatField('Сумма', default=0)
    timestamp = models.DateTimeField('Дата создания')
    status = models.PositiveSmallIntegerField('Статус', default=0)

    def isPaid(self):
        return self.status == 1

    def __str__(self):
        return 'От: %s, кому: %s, количество: %s' % (self.user_from, self.user_to, self.amount)

    class Meta:
        verbose_name = 'Транзакция'
        verbose_name_plural = 'Транзакции'

@@ -1170,32 +1170,39 @@
 .ForeignKey(User
+Profile
 , verbose_name='
@@ -1281,16 +1281,23 @@
 Key(User
+Profile
 , verbos
@@ -1461,62 +1461,8 @@
 =0)%0A
-    timestamp = models.DateTimeField('%D0%94%D0%B0%D1%82%D0%B0 %D1%81%D0%BE%D0%B7%D0%B4%D0%B0%D0%BD%D0%B8%D1%8F')%0A
     
@@ -1528,62 +1528,312 @@
 =0)%0A
-%0A    def isPaid(self):%0A        return self.status == 1
+    timestamp_create = models.DateTimeField('%D0%94%D0%B0%D1%82%D0%B0 %D1%81%D0%BE%D0%B7%D0%B4%D0%B0%D0%BD%D0%B8%D1%8F', auto_now_add=True)%0A    timestamp_confirm = models.DateTimeField('%D0%94%D0%B0%D1%82%D0%B0 %D0%BF%D0%BE%D0%B4%D1%82%D0%B2%D0%B5%D1%80%D0%B6%D0%B4%D0%B5%D0%BD%D0%B8%D1%8F', blank=True)%0A%0A    def isPaid(self):%0A        return self.status == 1%0A    def timestamp(self):%0A        return max(self.timestamp_create, self.timestamp_confirm)
 %0A%0A  

Add confirm timestamp and replace User with UserProfile in Transaction model