Excuse my total newbie question but how do I convert:
[<Location: London>]
or [<Location: Edinburgh>, <Location: London>]
etc
into:
'London' or 'Edinburgh, london'
Some background info to put it in context:
Models.py:
class Location(models.Model):
place = models.CharField(max_length=100)
def __unicode__(self):
return self.place
class LocationForm(ModelForm):
class Meta:
model = Location
forms.py
class BookingForm(forms.Form):
place = forms.ModelMultipleChoiceField(queryset=Location.objects.all(), label='Venue/Location:', required=False)
views.py
def booking(request):
if request.method == 'POST':
form = BookingForm(request.POST)
if form.is_valid():
place = form.cleaned_data['place']
recipients.append(sender)
message = '\nVenue or Location: ' + str(place)
send_mail('Thank you for booking', message, sender, recipients)
)