Add is_published property
This commit is contained in:
		
					parent
					
						
							
								12f2544ad5
							
						
					
				
			
			
				commit
				
					
						30ea472372
					
				
			
		
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
					@ -285,6 +285,13 @@ class Post(ModelMeta, TranslatableModel):
 | 
				
			||||||
    def get_full_url(self):
 | 
					    def get_full_url(self):
 | 
				
			||||||
        return self.build_absolute_uri(self.get_absolute_url())
 | 
					        return self.build_absolute_uri(self.get_absolute_url())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @property
 | 
				
			||||||
 | 
					    def is_published(self):
 | 
				
			||||||
 | 
					        return (self.publish and
 | 
				
			||||||
 | 
					                (self.date_published and self.date_published <= timezone.now()) and
 | 
				
			||||||
 | 
					                (self.date_published_end is None or self.date_published_end > timezone.now())
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class BasePostPlugin(CMSPlugin):
 | 
					class BasePostPlugin(CMSPlugin):
 | 
				
			||||||
    app_config = AppHookConfigField(
 | 
					    app_config = AppHookConfigField(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue