Re: Load a static file with a variable name

2015-10-07 Thread I . Dié
Thank you very much monsieur François 

Le mardi 6 octobre 2015 20:40:01 UTC+2, François Schiettecatte a écrit :
>
> The '+' is an error, the line look more like this:
>
>  />
>
> On Tue, Oct 6, 2015 at 2:33 PM, I. Dié <idie@gmail.com > 
> wrote:
>
>> I tried in your way to concatenate, I don't get any exception, but  the 
>> image image does'nt want to display. The plage only throw the "alt" value. 
>> Even for this line of code it's thing.
>>
>>
>> Le mardi 6 octobre 2015 19:51:04 UTC+2, Shawn Milochik a écrit :
>>>
>>> Try this:
>>>
>>> >> pet.name }} />
>>>
>>> You're embedding {{pet_name}} in a string. If this was a regular Python 
>>> statement, it would be like writing "Hello, {0}" and not having a format() 
>>> at the end.
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f29da80b-ffe4-421c-9aba-8ad76b87a484%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/f29da80b-ffe4-421c-9aba-8ad76b87a484%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ca812bda-3eff-49fa-b4ab-db10b9d1101b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Load a static file with a variable name

2015-10-06 Thread I . Dié
I tried in your way to concatenate, I don't get any exception, but  the 
image image does'nt want to display. The plage only throw the "alt" value. 
Even for this line of code it's thing.


Le mardi 6 octobre 2015 19:51:04 UTC+2, Shawn Milochik a écrit :
>
> Try this:
>
>  pet.name }} />
>
> You're embedding {{pet_name}} in a string. If this was a regular Python 
> statement, it would be like writing "Hello, {0}" and not having a format() 
> at the end.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f29da80b-ffe4-421c-9aba-8ad76b87a484%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Load a static file with a variable name

2015-10-06 Thread I . Dié
Hi everybody,

I want to load a image with a variable name   in  detail.html like this:

{% load staticfiles %}


the image won't load. But when I try this way, it's work perfectly:

{% load staticfiles %}


Here is my question How to load a static file with a variable name? Ps: 
pet.name value is always the image's name for each pet.

best regards

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/83297d6e-98a8-4add-96a2-f742e4b423d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to pass a string as url's parameter

2015-08-14 Thread I . Dié

Thanks you all  Snejy and James.
Regards 


>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0a50fae7-d714-4a54-a533-8ac9eb74f6d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to pass a string as url's parameter

2015-08-13 Thread I . Dié
Hi evrybody,

Here is my model:

# fruits/models
Class Fruit (models.Model):
name =  models.CharField(max_length = 33,
   choices = NAME_CHOICES, default = MANGO)
   # and so on...

# fruits/views
def fruit(request, fruit_name):
fruit = get_object_or_404(Fruit)
return render(request, 'fruits/fruit.html', {'fruit': fruit})

# fruits/urls
urlpatterns = [
url(r'^$', views.index, name="index"),
url(r'^(?P[-\w]+)/$', views.fruit, name='fruit'),
]

When I used fruit_id, everything was ok. 
But I want to know how to use Fruit.name (a string) as url's parameter 
instead of fruit_id like this: myverybigmarket/fruits/mango better than 
myverybigmarket/fruits/1

Ps: this is my first python/django project.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/404e6ef5-99d7-4e38-8bf1-978b8690d733%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.