I am creating a project which needs an audit in the database about all kind of actions performed by the user. For this objective, I m using 'Django-activity-stream' which creates its model properly.
I want to change the type of one parameter in the model generated by this library but I m not sure how to do it.
PD: This is my first time with Django and has seen the documentation of both but I'm not really sure.
If I explained something wrong or you need more info about it ask me without any problem.
EDIT1: Lib 'Django-activity-stream' create the next migration by model 'Action'
migrations.CreateModel(
name='Action',
fields=[
('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, help_text='', auto_created=True)),
('actor_object_id', models.CharField(max_length=255, db_index=True, help_text='')),
('verb', models.CharField(max_length=255, db_index=True, help_text='')),
('description', models.TextField(blank=True, null=True, help_text='')),
('target_object_id', models.CharField(max_length=255, blank=True, null=True, db_index=True, help_text='')),
('action_object_object_id', models.CharField(max_length=255, blank=True, null=True, db_index=True, help_text='')),
('timestamp', models.DateTimeField(db_index=True, default=django.utils.timezone.now, help_text='')),
('public', models.BooleanField(db_index=True, default=True, help_text='')),
('data', DataField(blank=True, null=True, help_text='')),
('action_object_content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, blank=True, null=True, help_text='', related_name='action_object', to='contenttypes.ContentType')),
('actor_content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, help_text='', related_name='actor', to='contenttypes.ContentType')),
('target_content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, blank=True, null=True, help_text='', related_name='target', to='contenttypes.ContentType')),
],
options={
'ordering': ('-timestamp',),
},
),
I only want to change the parameter 'verb' from models.CharField to models.ForeignKey and associated it to with a model I defined previously.
Finally, to solve this problem i made the next steps:
This has been my decision because the documentation and another questions about this topic said that Django doesnt allow to do it. Then the unique method viable is fork and modify it.