It's true: the Run model does not have a "lines" attribute; the 
RunHasSample model does.  Also, `s1` is not a Line nor a Sample, it's an 
instance of the intermediary RunHasSample.  So you're not going to be able 
to directly add a Line instance to a Run instance- you'll have to add it to 
the relevant RunHasSample instance instead.


On Friday, October 19, 2012 11:11:57 AM UTC-5, Louise OTT wrote:
>
> In [10]: run1= Run(project=Project.objects.get(pk=1), 
>>> sequencing_type=SequencingType.objects.get(pk=1))
>>
>>
>>> In [11]: run1.save()
>>
>>
>>> In [12]: Run.objects.all()
>>
>> Out[12]: [<Run: run started None from the project test project>]
>>
>>
>>> In [13]: s1=RunHasSample(run=run1, sample=Sample.objects.get(pk=1), 
>>> dna_quantification_ng_per_ul=1)
>>
>>
>>> In [14]: s1.save()
>>
>>
>>> In [15]: run1.lines.add(s1)
>>
>>
>>> ---------------------------------------------------------------------------
>>
>> AttributeError                            Traceback (most recent call 
>>> last)
>>
>> /opt/scyld/python/2.6.5/lib/python2.6/site-packages/django/core/management/commands/shell.pyc
>>  
>>> in <module>()
>>
>> ----> 1 run1.lines.add(s1)
>>
>>
>>> AttributeError: 'Run' object has no attribute 'lines'
>>
>>
>>> In [16]: run1.lines.add(s1)
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/2oK9vg_3HfUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to