A Weblog by Russ Turley
Alright, this seems a little embarassing. I’ve never put up code before for public scrutiny. I put up podcasts all the time that may be a little iffy, I make blog posts, but this seems different. I’m learning this and so I feel very naked posting this. But here it is any way. I’m not putting in any user authentication as of yet. I’m going to get the meat of the application done and then I’m going to put the polish on afterward. Again, I’m learning.
I haven’t found a good way to include code in WordPress. If you have a solution, please let me know.
Here’s the model file:
from django.db import models PODCAST_GENRE_CHOICES = ( ('TE', 'Technology'), ('HF', 'Health'), ('MU', 'Music'), ('PB', 'Podiobook'), ('OU', 'Outdoor'), ('EN', 'Entertainment'), ('WA', 'World Affairs'), ('LS', 'Lifestyle'), ) class Podcast(models.Model): url=models.URLField() feed_url=models.URLField() album_art=models.URLField(null=True, blank=True) itunes_feed_id=models.IntegerField(null=True, blank=True, maxlength=10) title=models.CharField(maxlength=255) description=models.TextField() sample_podcast=models.URLField(null=True, blank=True) genre=models.CharField(maxlength=2, choices=PODCAST_GENRE_CHOICES) created_date=models.DateField(auto_now_add=True) modified_date=models.DateField(auto_now=True) def __str__(self): return self.title class Admin: pass list_display = ('title', 'url') def get_absolute_url(self): return "/podcasts/%i/" %self.id
Here’s a link to the file: Django Model
Well, that’s the model for the podcasts. I’m not planning on reading in the Feeds and displaying the episodes as of yet. One step at a time, right?
So you Pythonistas, Djangonauts…
What’s wrong with this?
What’s right with it?
What am I missing?
Next post will be a little about the generic views that I’ll be using to create the podcast listing and the detail pages. I’ve already got the podcast list done and the detail. I’ll post that soon. After that, I’ll tackle the CRUD of making changes to the podcast details. Finally, I’ll implement user login and then I’ll go from there.
I’ve selected a template from freecsstemplates.org to use in the site, just so it’s not so darn plain. I’ll also get that server up so others can add their data to the database and try out the application.