6👍
Adding prt
directly should work on first try. How are you retrieving pl
and prt
? Assuming you have some data in your database, try those commands from the Django shell and see if it works. There seems to be some missing information from the question. After running python manage.py shell
:
from yourapp.models import PL
pl = PL.objects.get(id=1)
prt = PRT.objects.get(id=1)
pl.mentionedby.add(prt)
0👍
Are these the complete models? I can only assume that something’s been overriden somewhere, that probably shouldn’t have been.
Can you post the full code?
👤Mez
- [Django]-Django forms custom validation on two fields one or the other
- [Django]-How can I improve this "register" view in Django?
- [Django]-In Django, is there an easy way to render a text field as a template, in a template?
- [Django]-How can i save a file response with jQuery?
Source:stackexchange.com