List Info

Thread: select option to return primary key?




select option to return primary key?
country flaguser name
United States
2007-09-28 07:16:01
Hi,

I'm building a page where a person has to choose who is to
perform an
action.   The 'who' comes from the 'auth_user' table.

<select name="id_tecnico"
size="1">
    {% for i in inst %}
    <option>
 {{ i.first_name|lower|capfirst }} {{
i.last_name|lower|capfirst }}
{{ i.id }}
    {% endfor %}
</select>

I would like first_name and last_name to appear on the
select box, but
not the id field.

But I would like to have the id returned to the view, as it
is the
primary key of users.   Is there a way to do this (in
django/html)?

Otherwise, the only solution I can see is to return
first_name and
last_name only to the view, and try to find the id of that
user from
the table.   Is this the way to go?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: select option to return primary key?
country flaguser name
United States
2007-09-28 07:51:06
How about
<option value="{{i.id}}">

Now the id_tecnico should have the value of your persons id
in your
view.

On Sep 28, 3:16 pm, "luisl...gmail.com"
<luisl...gmail.com> wrote:
> Hi,
>
> I'm building a page where a person has to choose who is
to perform an
> action.   The 'who' comes from the 'auth_user' table.
>
> <select name="id_tecnico"
size="1">
>     {% for i in inst %}
>     <option>
>  {{ i.first_name|lower|capfirst }} {{
i.last_name|lower|capfirst }}
> {{ i.id }}
>     {% endfor %}
> </select>
>
> I would like first_name and last_name to appear on the
select box, but
> not the id field.
>
> But I would like to have the id returned to the view,
as it is the
> primary key of users.   Is there a way to do this (in
django/html)?
>
> Otherwise, the only solution I can see is to return
first_name and
> last_name only to the view, and try to find the id of
that user from
> the table.   Is this the way to go?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: select option to return primary key?
country flaguser name
United States
2007-09-28 07:56:55

Glebb escreveu:
> How about
> <option value="{{i.id}}">
>
> Now the id_tecnico should have the value of your
persons id in your
> view.
Hi Glebb,

that was it.  Thank you very much!

Luis



>
> On Sep 28, 3:16 pm, "luisl...gmail.com" <luisl...gmail.com> wrote:
> > Hi,
> >
> > I'm building a page where a person has to choose
who is to perform an
> > action.   The 'who' comes from the 'auth_user'
table.
> >
> > <select name="id_tecnico"
size="1">
> >     {% for i in inst %}
> >     <option>
> >  {{ i.first_name|lower|capfirst }} {{
i.last_name|lower|capfirst }}
> > {{ i.id }}
> >     {% endfor %}
> > </select>
> >
> > I would like first_name and last_name to appear on
the select box, but
> > not the id field.
> >
> > But I would like to have the id returned to the
view, as it is the
> > primary key of users.   Is there a way to do this
(in django/html)?
> >
> > Otherwise, the only solution I can see is to
return first_name and
> > last_name only to the view, and try to find the id
of that user from
> > the table.   Is this the way to go?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )