Hi,
On Tue, 6 Aug 2013 20:19:01 -0700 (PDT) Muhammed TÜFEKYAPAN
wrote:
> def home(request):
> output = Excuse.objects.order_by('?')[:1]
[:1] selects all elements from the beginning up to the first and
returns that list. true, its a list with only one member, but still a
list.
You want [0] t
"outout = Excuse.objects.order_by('?')[0]"
This works well.
Thank you.
On Wednesday, August 7, 2013 6:19:01 AM UTC+3, Muhammed TÜFEKYAPAN wrote:
>
> Hello everyone,
>
> I write a basic model in django 1.5.1
>
> My model is looks like this:
> class Excuse(models.Model):
> text = models.Cha
Hi,
If you tries to access values from list using slice it returns you the
subset of list not a single value.The query *(*Excuse.objects.order_by('?')*
)* from your view returns a list and you are trying to access values from
that list using slice which in turn returns subset of list and becau
It looks like this:
{{ output }}
On Wednesday, August 7, 2013 6:58:17 AM UTC+3, Bulkan-Savun Evcimen wrote:
>
> Hi there,
>
> What does your template index.html look like ?
>
> Cheers
>
> http://bulkan-evcimen.com
>
>
> On Wed, Aug 7, 2013 at 1:19 PM, Muhammed TÜFEKYAPAN
>
> > wrote:
Hi there,
What does your template index.html look like ?
Cheers
http://bulkan-evcimen.com
On Wed, Aug 7, 2013 at 1:19 PM, Muhammed TÜFEKYAPAN
wrote:
> Hello everyone,
>
> I write a basic model in django 1.5.1
>
> My model is looks like this:
> class Excuse(models.Model):
> text = models.CharF
Hello everyone,
I write a basic model in django 1.5.1
My model is looks like this:
class Excuse(models.Model):
text = models.CharField(max_length=300)
def __unicode__(self):
return self.text
And i have a basic function to get random excuse from this model.
def home(request):
output = Excus
6 matches
Mail list logo