improved Proposal.proposal
* renamed the field to avoid nasty underscore * fixed code to avoid extra query
This commit is contained in:
		
							parent
							
								
									a2b72499e0
								
							
						
					
					
						commit
						db66749046
					
				
					 1 changed files with 4 additions and 5 deletions
				
			
		|  | @ -67,7 +67,7 @@ class Presentation(models.Model): | |||
|     speaker = models.ForeignKey("speakers.Speaker", related_name="presentations") | ||||
|     additional_speakers = models.ManyToManyField("speakers.Speaker", blank=True) | ||||
|     cancelled = models.BooleanField(default=False) | ||||
|     _proposal = models.OneToOneField(ProposalBase, related_name="presentation") | ||||
|     proposal_base = models.OneToOneField(ProposalBase, related_name="presentation") | ||||
|     section = models.ForeignKey(Section, related_name="presentations") | ||||
|      | ||||
|     @property | ||||
|  | @ -76,10 +76,9 @@ class Presentation(models.Model): | |||
|      | ||||
|     @property | ||||
|     def proposal(self): | ||||
|         if self._proposal: | ||||
|             proposal = ProposalBase.objects.get_subclass(pk=self._proposal.pk) | ||||
|             return proposal | ||||
|         if self.proposal_base_id is None: | ||||
|             return None | ||||
|         return ProposalBase.objects.get_subclass(pk=self.proposal_base_id) | ||||
|      | ||||
|     def speakers(self): | ||||
|         yield self.speaker | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Brian Rosner
						Brian Rosner