Instead of using the model class, or string name of the model class, use
the string value 'self'.

https://docs.djangoproject.com/en/3.0/ref/models/fields/#foreignkey

On Sun, Mar 29, 2020 at 9:44 PM Mohsen Pahlevanzadeh <
m.pahlevanza...@gmail.com> wrote:

> I have table A with my following fields:
> 1. id (PK)
> 2. fname (text)
> 3. name (text)
> 4. A_id (integer)
>
> I have problem with 4th field, Because it has to refrenced to id
> field. I can't implement it into Django.
>
> How can I write model class for above table in models.py ?
>
> --mohsen
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJFFGZKZLQDNMA%2BzSUFKvUX8c0eMe%2B7do73cV1RyZTO1q-A3gg%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAD4ANxVFOKpakv8OBP6FQXnCyfnskhsxgkXfbf22DL%3DB8E-c%3Dg%40mail.gmail.com.

Reply via email to