Example #1
0
	def formfield_for_dbfield(self, db_field, **kwargs):
		if db_field.name == 'channel':
			kwargs['widget'] = forms.Select(
				choices = helpers.get_provider_channels()
			)
		
		return super(ServiceFeedInline, self).formfield_for_dbfield(db_field, **kwargs)
Example #2
0
	def kind(self):
		if self.feed.content_type.model == 'servicefeed':
			feed = ServiceFeed.objects.get(feed_ptr = self.feed)
			for c, n in helpers.get_provider_channels(feed.service.provider):
				if c == feed.channel:
					return CHANNEL_NAME_EX.match(c).groups()[0]
		elif self.feed.content_type.model == 'rssfeed':
			feed = RSSFeed.objects.get(feed_ptr = self.feed)
			scheme, netloc, path, params, query, fragment = urlparse(feed.url)
			return netloc.replace('.', '-')
		
		return 'item'
Example #3
0
	def __unicode__(self):
		for c, n in helpers.get_provider_channels(self.service.provider):
			if c == self.channel:
				return CHANNEL_NAME_EX.match(c).groups()[0]
		
		return ''