podjango: Upload icon per podcast
This commit is contained in:
		
							parent
							
								
									956f8c6fda
								
							
						
					
					
						commit
						1a05c6391c
					
				
					 7 changed files with 34 additions and 6 deletions
				
			
		|  | @ -61,13 +61,13 @@ class CastFeedBase(Feed): | |||
| def for_podcast_feed_extra_kwargs(self, obj): | ||||
|     return { | ||||
|         'managingEditorNames': 'Bradley and Karen', | ||||
|         'rssImage': {'url': 'https://sfconservancy.org/static/podjango/img/cast/tcs_300x300.jpg', | ||||
|                      'width': '144', 'height': '144'}, | ||||
|         'rssImage': {'url': add_domain(self.current_site.domain, obj.icon.url, self.is_secure), | ||||
|                      'width': '300', 'height': '300'}, | ||||
|         'webMaster': 'oggcast@faif.us (Bradley and Karen)', | ||||
|         'dcCreator': 'oggcast@faif.us (Bradley and Karen)', | ||||
|         'iTunesExplicit': 'No', | ||||
|         'iTunesBlock': 'No', | ||||
|         'iTunesImage': {'url': 'https://sfconservancy.org/static/podjango/img/cast/tcs_300x300.jpg', | ||||
|         'iTunesImage': {'url': add_domain(self.current_site.domain, obj.icon.url, self.is_secure), | ||||
|                         'title': 'The Corresponding Source (formerly Free as in Freedom)', | ||||
|                         'link': self.author_link, | ||||
|                         'type': 'video/jpg'}, | ||||
|  | @ -192,8 +192,8 @@ class CastFeed(CastFeedBase): | |||
|     author_email = "podcast@faif.us" | ||||
|     author_link = "https://sfconservancy.org/" | ||||
|     author_name = "Software Freedom Conservancy" | ||||
|     title_template = "feeds/podcast_title.html" | ||||
|     description_template = "feeds/podcast_description.html" | ||||
|     title_template = "feed_title.html" | ||||
|     description_template = "feed_description.html" | ||||
| 
 | ||||
|     def get_feed(self, obj, request): | ||||
|         # Enclosure (media) URLs don't automatically get the protocol and | ||||
|  |  | |||
							
								
								
									
										18
									
								
								conservancy/podjango/migrations/0006_podcast_icon.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								conservancy/podjango/migrations/0006_podcast_icon.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| # Generated by Django 4.2.11 on 2024-04-26 01:40 | ||||
| 
 | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('podjango', '0005_podcast_long_description'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.AddField( | ||||
|             model_name='podcast', | ||||
|             name='icon', | ||||
|             field=models.ImageField(null=True, upload_to=''), | ||||
|         ), | ||||
|     ] | ||||
|  | @ -27,6 +27,7 @@ class Podcast(models.Model): | |||
|     title = models.CharField(max_length=50) | ||||
|     slug = models.SlugField(unique=True) | ||||
|     long_description = models.TextField(blank=True) | ||||
|     icon = models.ImageField(null=True) | ||||
| 
 | ||||
|     def __str__(self): | ||||
|         return self.title | ||||
|  |  | |||
|  | @ -17,8 +17,10 @@ | |||
| # along with this program in a file in the toplevel directory called | ||||
| # "AGPLv3".  If not, see <http://www.gnu.org/licenses/>. | ||||
| 
 | ||||
| from django.urls import include, path, re_path | ||||
| from django.conf import settings | ||||
| from django.conf.urls.static import static | ||||
| from django.contrib import admin | ||||
| from django.urls import include, path, re_path | ||||
| 
 | ||||
| from . import feeds, frontpage, sponsors | ||||
| from .fundgoal import views as fundgoal_views | ||||
|  | @ -59,3 +61,9 @@ urlpatterns = [ | |||
|     re_path(r'^projects/', static_views.index), | ||||
|     re_path(r'^sustainer/', static_views.index), | ||||
| ] | ||||
| 
 | ||||
| # Serve uploaded media. Works only when DEBUG == True. Using '/media/' | ||||
| # explicitly here because MEDIA_URL include scheme/host/port, which would | ||||
| # otherwise break debug media serving. | ||||
| # https://docs.djangoproject.com/en/4.0/howto/static-files/#serving-files-uploaded-by-a-user-during-development | ||||
| urlpatterns += static('/media/', document_root=settings.MEDIA_ROOT) | ||||
|  |  | |||
|  | @ -4,3 +4,4 @@ Django==4.2.11 | |||
| beautifulsoup4==4.11.2 | ||||
| html5lib==1.1 | ||||
| django-countries==7.3.2 | ||||
| Pillow==9.4.0 | ||||
		Loading…
	
	Add table
		
		Reference in a new issue