Django database and information history

I am using Django framework to build a website with the ability to record user information and its history of modification. As what i can image, i can use a Django self-defined app to record the information history. This self-defined app would contain classes with information stored in dictionary.

    Class Information(models.Model):
        user = models.OneToOneField(User)

        info = {'date': value}

    def create_information(sender, instance, created, **kwargs):
    if created:
    post_save.connect(create_control_information, sender=User)

Can any one tell me if there is some other better way to record information in Django web developing?


Firstly, Because You'll want to access your user's history directly from a User instance, use django's ForeignKey field.

When doing so, accessing a users history will look something like this:


You can change the name the user's history from 'information_set' to, for example, 'history', by specifying related_name argument in the ForeignKey constructor, like so:

Class Information(models.Model):

And now to access a user's history, you can write:


Also, Please notice that in your current design, the info won't be stored in the database. I assume that most of the history data you want to store will have the same structure. Consider using a field for each piece of info you want to keep in your history. For example, for keeping the date and time of the action, use DateTimeField

Need Your Help

Removing repeated characters, preserving order

java string

I'm trying to write a code that takes in a String and removes repeating characters in that String.

keep doing scanf for all input in command line. C program

c command-line input scanf

I am trying to get all the input from the command line and putting it in a linked list.