def create(request): this_user = request.user band_name = request.POST.get( 'band_name', '' ) this_band = Band.objects.create( name=band_name ) membership = UserHasBand( user=this_user, band=this_band ) membership.save() return HttpResponseRedirect('/dashboard/')
def join(request, band_id): this_user = request.user this_band = Band.objects.get(pk=band_id) membership = UserHasBand( user=this_user, band=this_band ) membership.save() return HttpResponseRedirect('/dashboard/')