Let's not store the thread URL then, and just construct it each time, so
we're robust against it changing.


On Sun, Sep 29, 2013 at 1:25 PM, Eugene Fang <notifications@github.com>wrote:

> In models/media.py:
>
> > +
> > +class Media(ndb.Model):
> > +    """
> > +    """
> > +
> > +    # Do not change! key_names are generated based on this
> > +    SLUG_NAMES = {
> > +        MediaType.YOUTUBE: 'youtube',
> > +        MediaType.CD_PHOTO_THREAD: 'cdphotothread',
> > +    }
> > +
> > +    # media_type and media_id make up the key_name
> > +    media_type_enum = ndb.IntegerProperty(required=
> True)
> > +    media_id = ndb.StringProperty(required=True)  # Unique id for the particular media type. Ex: the "random" string at the end of a YouTube url
> > +
> > +    details_json = ndb.StringProperty()  # Additional details required for rendering
>
> Example:
> Thread url: http://www.chiefdelphi.com/media/photos/39142
> Image url:
> http://www.chiefdelphi.com/media/img/774/774d98c80dcf656f2431b2e9186f161a_l.jpg
>
> So yes, the thread url is the media_id (or foregin_key if you wish) in a
> template. Image url seems pretty arbitrary.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/gregmarra/the-blue-alliance/pull/762/files#r6648227>
> .
>