So I'm having a bit of trouble. I get a 404 when I try to visit the url for a certain model:
url(r'^rewards/(?P<slug>[-\w]+)/$', RedeemReward.as_view(), name="reward"),
url(r'^rewards/(?P<slug>[-\w]+)/$', CompanyDetail.as_view(), name="company"),
So the top url will be something like rewards/amazon-gift card, while the bottom url would be something like rewards/amazon (to show all of the gift cards that amazon has to offer). The reward url works as expected, but I get a 404 when I try to visit the bottom url. The view:
class CompanyDetail(DetailView):
model = Company
context_object_name = 'company'
slug_field = 'company_slug'
template_name = 'asdx/companies.html'
def get_rewards(self):
rewards = Reward.objects.filter(company=self.object)
return rewards
def get_context_data(self, **kwargs):
context = super(CompanyDetail, self).get_context_data(**kwargs)
context['rewards'] = self.get_rewards()
return context
What's going on here?