I have Business model that has an active field that defaults to False. This field is set to True when the user has submitted a payment.
The business model has a “profile” page. I was wondering if there is any way of not allowing access to that profile page if the active field is not set to True.
urlpatterns = patterns('listings.views',
# other patterns here...
url(r'^profile/(?P<slug>[A-Za-z0-9-]+)/$', 'business_profile', name="business_profile"),
# other urls here...
)
Should I just check this field in the view.business_profile method? Or is there a better way of doing this?
One better way might be to set the
business_profileview to return a 404 in case the ‘business model’ instance hasactive=False.