#35410: Can't Set a Default Value for ForeignKey Field in Custom User Model -------------------------------------+------------------------------------- Reporter: Ebram Shehata | Owner: nobody Type: Bug | Status: closed Component: contrib.auth | Version: 5.0 Severity: Normal | Resolution: invalid Keywords: migrations, | Triage Stage: foreignkey, user, models | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Tim Graham):
* resolution: => invalid * status: new => closed Comment: You didn't provide the full traceback but I suspect the error comes from `Department.objects.get_or_create()`. I don't think Django is at fault. You could make the migrations in two steps, adding the `default` only after the `Department` table is created. -- Ticket URL: <https://code.djangoproject.com/ticket/35410#comment:1> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107018f1b985be9-9dce0c7b-1583-4ba8-b66b-bd11cfc50b5c-000000%40eu-central-1.amazonses.com.