Proble understanding DetailView url doesn't match the slug

2015-02-13 Thread inoyon artlover KLANGRAUSCH
Hi there, there is something I obviously don't understand. According to 
django reference,
the DetailView has to be provided a slug or pk. I do it in the url but 
django constantly doesn't
recognize the slug in the url.  'current url doesn't match etc.' what is 
wrong here? I do everything
like it is explaind and it doesn't work.. very frustrating sometimes...


My models.py:

class List01(models.Model):
name = models.CharField(max_length=100, default='name')
surename = models.CharField(max_length=100, default='surename')
slug = models.SlugField()


views.py

class List(DetailView):
template_name = 'index.html'
model =List01

urls.py

urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^(?P)$',List.as_view()),
)

-- 
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/64985ae3-187f-4abd-b6ab-2df93557df76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to get a link to an absolute hyperlink

2015-02-13 Thread Vijay Khemlani
Try adding "http://"; at the start

Also, consider that the format is 111.111.111.111: (the port is after a
colon, not a dot)

On Fri, Feb 13, 2015 at 8:03 PM, dk  wrote:

> its just a string with an ip address and that's it.
>
>  {{ j }} 
> so at the end should be something like
> 11.111.11. 
>
> instead I get the hole path of my url + /11.111.11.
> I just want to go to 11.111.11.
>
>
>
>
> On Friday, February 13, 2015 at 4:46:44 PM UTC-6, daniel.franca wrote:
>
>> How's the hyperlink saved in the column? If it's a relative one this is
>> what is going to happen, to change that you need an absolute link, i.e:
>> http://google.com
>> On Fri 13 Feb 2015 at 23:40 dk  wrote:
>>
>>> this is my template
>>> I do have this address
>>> http://127.0.0.1:8000/mes/show_table/
>>> and show a table where the second colum is a link to somewhere else,
>>> the problem is when I click it lunch me to
>>> http://127.0.0.1:8000/mes/show_table/clickedLinkand doesn't work.
>>>
>>> as an example if one of my links in the table is pointing to google
>>> o do get
>>> http://127.0.0.1:8000/mes/show_table/google
>>> instead of just
>>> google
>>>
>>> is there a tag or some magic in django to say  just send me here?
>>>
>>> thanks  guys.
>>>
>>>
>>>  
>>>  {% for i in lista %}
>>>  
>>> {% for j in i %}
>>>{% if forloop.counter == 4 %}
>>>>> >{{ j }}  
>>>{% else %}
>>>   {{ j }}
>>>
>>>{% endif %}
>>> {% endfor %}
>>>  
>>>
>>>  {% endfor %}
>>>
>>>  --
>>> 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/c6ccb7e1-e202-45cc-a458-02b6c9029eea%
>>> 40googlegroups.com
>>> 
>>> .
>>> 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/04c2d8ae-8ea5-4847-bbdc-0dc1e323eff7%40googlegroups.com
> 
> .
>
> 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/CALn3ei30TOZ2e-ANrzhjyfb0vTV%2B-GAwa8w%3DYG_BTSESAXyW3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to get a link to an absolute hyperlink

2015-02-13 Thread dk
its just a string with an ip address and that's it.  

 {{ j }} 
so at the end should be something like
11.111.11. 

instead I get the hole path of my url + /11.111.11.   
I just want to go to 11.111.11.




On Friday, February 13, 2015 at 4:46:44 PM UTC-6, daniel.franca wrote:

> How's the hyperlink saved in the column? If it's a relative one this is 
> what is going to happen, to change that you need an absolute link, i.e: 
> http://google.com
> On Fri 13 Feb 2015 at 23:40 dk > wrote:
>
>> this is my template
>> I do have this address
>> http://127.0.0.1:8000/mes/show_table/
>> and show a table where the second colum is a link to somewhere else,  the 
>> problem is when I click it lunch me to
>> http://127.0.0.1:8000/mes/show_table/clickedLinkand doesn't work.
>>
>> as an example if one of my links in the table is pointing to google
>> o do get 
>> http://127.0.0.1:8000/mes/show_table/google
>> instead of just
>> google
>>
>> is there a tag or some magic in django to say  just send me here?
>>
>> thanks  guys.
>>
>>
>>  
>>  {% for i in lista %}
>>  
>> {% for j in i %}
>>{% if forloop.counter == 4 %}
>>{{ 
>> j }}  
>>{% else %}
>>   {{ j }}
>>
>>{% endif %}
>> {% endfor %}
>>  
>>
>>  {% endfor %}
>>
>>  -- 
>> 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/c6ccb7e1-e202-45cc-a458-02b6c9029eea%40googlegroups.com
>>  
>> 
>> .
>> 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/04c2d8ae-8ea5-4847-bbdc-0dc1e323eff7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to get a link to an absolute hyperlink

2015-02-13 Thread Daniel França
How's the hyperlink saved in the column? If it's a relative one this is
what is going to happen, to change that you need an absolute link, i.e:
http://google.com
On Fri 13 Feb 2015 at 23:40 dk  wrote:

> this is my template
> I do have this address
> http://127.0.0.1:8000/mes/show_table/
> and show a table where the second colum is a link to somewhere else,  the
> problem is when I click it lunch me to
> http://127.0.0.1:8000/mes/show_table/clickedLinkand doesn't work.
>
> as an example if one of my links in the table is pointing to google
> o do get
> http://127.0.0.1:8000/mes/show_table/google
> instead of just
> google
>
> is there a tag or some magic in django to say  just send me here?
>
> thanks  guys.
>
>
>  
>  {% for i in lista %}
>  
> {% for j in i %}
>{% if forloop.counter == 4 %}
>{{ 
> j }}  
>{% else %}
>   {{ j }}
>
>{% endif %}
> {% endfor %}
>  
>
>  {% endfor %}
>
>  --
> 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/c6ccb7e1-e202-45cc-a458-02b6c9029eea%40googlegroups.com
> 
> .
> 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/CACPst9%2BT9Nq-CfVsUHfpwXiysOCNiBq9M3SdXRd99r6puLf0gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: passing a list of list to a template

2015-02-13 Thread Vijay Khemlani
I think you can make comparisons, but try to limit the amount of logic that
you implement in your templates.

On Fri, Feb 13, 2015 at 6:14 PM, dk  wrote:

> I am assuming in django  doing i.1  or i.2  will be the same as  i[1],
> i[2] right?
>
> can I do if statements too?  like if i.2 == to somestuff? do something? or
> all that need to be set in the view function?
>
> thanks
>
>
> On Thursday, February 12, 2015 at 12:15:50 PM UTC-6, Vijay Khemlani wrote:
>
>> If you have a fixed number of items in each of the sublists you can do
>>
>> {{ i.0 }}   # First element
>> {{ i.1 }}   # Second element
>>
>> or you can iterate over it
>>
>> {% for sub_element in i %}
>> {{ sub_element }}
>> {% endfor %}
>>
>> On Thu, Feb 12, 2015 at 2:55 PM, dk  wrote:
>>
>>> i do have a list  of list like this
>>> [  [apple, banana, red] ,  [orange, grape, blue] ,  [watermelon,
>>> tangerine, purple]   ]
>>>
>>>
>>> then i am passing it to the template like
>>> return render(request, "show_table.html", {"lista": lista})
>>> inside my template html i have
>>>
>>>
>>> 
>>> {% for i in lista %}
>>> 
>>> {{ i }}
>>> {# > Temp  #}
>>> {# {{ i }}#}
>>> 
>>>
>>> {% endfor %}
>>> 
>>>
>>>
>>>
>>> but how can i select i[0]   or i[2] to put then into a diferent
>>> column?might be a better trick on how to send it?
>>> 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...@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/ec4f230b-73f0-495c-ad2d-db921ed227cc%
>>> 40googlegroups.com
>>> 
>>> .
>>> 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/63004a1d-6aad-481b-9563-26182bbd9f39%40googlegroups.com
> 
> .
>
> 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/CALn3ei1RFeV9B0Qfpwcx5PYZ%3DYU55Vk6yYU4Gnqbrx1dd1wBHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


how to get a link to an absolute hyperlink

2015-02-13 Thread dk
this is my template
I do have this address
http://127.0.0.1:8000/mes/show_table/
and show a table where the second colum is a link to somewhere else,  the 
problem is when I click it lunch me to
http://127.0.0.1:8000/mes/show_table/clickedLinkand doesn't work.

as an example if one of my links in the table is pointing to google
o do get 
http://127.0.0.1:8000/mes/show_table/google
instead of just
google

is there a tag or some magic in django to say  just send me here?

thanks  guys.


 
 {% for i in lista %}
 
{% for j in i %}
   {% if forloop.counter == 4 %}
   {{ j 
}}  
   {% else %}
  {{ j }}

   {% endif %}
{% endfor %}
 

 {% endfor %}

-- 
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/c6ccb7e1-e202-45cc-a458-02b6c9029eea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: passing a list of list to a template

2015-02-13 Thread dk
I am assuming in django  doing i.1  or i.2  will be the same as  i[1],  
i[2] right?

can I do if statements too?  like if i.2 == to somestuff? do something? or 
all that need to be set in the view function?

thanks 


On Thursday, February 12, 2015 at 12:15:50 PM UTC-6, Vijay Khemlani wrote:

> If you have a fixed number of items in each of the sublists you can do
>
> {{ i.0 }}   # First element
> {{ i.1 }}   # Second element
>
> or you can iterate over it
>
> {% for sub_element in i %}
> {{ sub_element }}
> {% endfor %}
>
> On Thu, Feb 12, 2015 at 2:55 PM, dk > 
> wrote:
>
>> i do have a list  of list like this
>> [  [apple, banana, red] ,  [orange, grape, blue] ,  [watermelon, 
>> tangerine, purple]   ]
>>
>>
>> then i am passing it to the template like
>> return render(request, "show_table.html", {"lista": lista})
>> inside my template html i have 
>>
>>
>> 
>> {% for i in lista %}
>> 
>> {{ i }}
>> {# > Temp  #}
>> {# {{ i }}#}
>> 
>>
>> {% endfor %}
>> 
>>
>>
>>
>> but how can i select i[0]   or i[2] to put then into a diferent 
>> column?might be a better trick on how to send it?
>> 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...@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/ec4f230b-73f0-495c-ad2d-db921ed227cc%40googlegroups.com
>>  
>> 
>> .
>> 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/63004a1d-6aad-481b-9563-26182bbd9f39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Handling FormSet client side with javascript

2015-02-13 Thread aRkadeFR

Hello everyone,

I'm using FormSet in order to add multiple object at once on
a view. To have a more user friendly approach, I created a
'my.formset.js' file and I need to include a 'jquery.formset.js' lib
to add/remove row of the formset (client side) and edit the
formset management information.

My idea to resolve this problem was to include these two
javascript media file everytime I'm using a formset.

A bit like every media js file for widgets :)

So my first attempt was something like that:
```
class BaseFormSet(BaseInlineFormSet):
class Media:
js = ("my.formset.js", "jquery.formset.js", )
```

but this doesnt render these js files with formset.media.render_js().

My second attempt was:
```
formset.media.add_js( ["my.formset.js", "jquery.formset.js", ])
```

My last attempt:
```
form = formset.forms[0]
formset.forms[0].fields[form.fields.keys()[0]].media.add_js(["my.formset.js", 
"jquery.formset.js", ])

```

Still not working cause the .media._js is regenerating the media js
files.

The only solution so far I have, provided by @tbaxter, is to
include all my js files in all my application, and initialize/use
the formset/widgets javascript only on certain condition.

I don't like the idea of including my js application wide. It's
gonna overload all my pages for nothing (my js files are
completely standalone) when there is no FormSet.

Can I have your tought on this probleme, and what solution
you have in mind?

Thank you,

--
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/54DE2006.9030001%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


Re: backend para MySQL

2015-02-13 Thread Dhelbegor
Versão para win: https://pypi.python.org/pypi/MySQL-python/1.2.5  só clicar 
no arquivo com nome  .exe(md5)
para instalar usando o pip ubuntu:  apt-get install libmysqlclient-dev

ref: 
http://stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found

-- 
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/e9aa499f-44e2-4bac-9b6f-90dc46ab4f80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Template Spaces and tabs

2015-02-13 Thread aRkadeFR

to be concise:
try using a  tag in your HTML ;)


{% for line in lines %}
{{ line }}
{% endfor %}


On 02/12/2015 09:32 PM, Tom Evans wrote:

On Thu, Feb 12, 2015 at 8:25 PM, Ulisses Cruz  wrote:

Hello
This may seem trivial but can you help?

I'm reading a file line by line and transforming it in a list of lines
(example: list_of_lines = [file_line1, file_line2, ...])
then I pass the list to a template to be displayed. (example: return
render(request, 'template/location.html', {'lines':list_fo_lines}))

In the template I have a for loop to white each line:

{% for line in lines %}
 {{ line }}
{% endfor %}

Now, the problem is that, in the file I wrote from, some words in a line
have more than one space and sometimes tabs between them.
I would like to keep them in the html page as well, but in the html page the
additional spaces and tabs do not appearing.

This does not have anything to do with django, but in an HTML
document, all whitespace is collapsed.

You can use a HTML tags to denote pre-formatted content.


I know the answer may be in HTML but I'm not getting there.

So you knew this wasn't the right place to send it, but thought "What the hell?"

There are many HTML tutorials out there that describe the common HTML
tags, I'd suggest investing some of *your* time in reading them, as
writing web applications is much easier when you have a grasp of HTML.

Cheers

Tom



--
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/54DE044F.3000202%40arkade.info.
For more options, visit https://groups.google.com/d/optout.