hogsolo
hogsolo

Reputation: 14505

Can I add a column to the Django auth_group table?

Im a newbie to Python, I need to add a extra column of data Django's auth_group table ( using Mysql db) . Since it's a built in model, I can't just add a column. Is there a way to extend it?

Upvotes: 1

Views: 1472

Answers (1)

risent
risent

Reputation: 136

use add_to_class method. Add a new field named created_at, in one of you models.py, add this code

from django.contrib.auth.models import Group
Group.add_to_class('created_at', models.DateTimeField(auto_now_add=True))

Upvotes: 4

Related Questions