yes, all tags have a color...
Can you suggest me another way to do this, please?
thank you .
Le mardi 25 octobre 2022 à 10:52:17 UTC+1, Simon King a écrit :
> Turn on debug logs (add echo="debug" to your db connection string) to see
> the SQL you are executing and the results you are getting back:
>
>
> https://docs.sqlalchemy.org/en/14/core/engines.html#sqlalchemy.create_engine.params.echo
>
> Are you sure that the database actually contains colours for those tags?
>
> Simon
>
> On Sat, Oct 22, 2022 at 3:37 PM Abdellah ALAOUI ISMAILI <
> my.ala...@gmail.com> wrote:
>
>> wheel ... in my template, I get just the first tag color, returned from
>> the function.
>>
>> this is the result of my HTML file source code :
>>
>>
>> LOG
>>
>> EXADATA
>>
>> DMZ_PRIVE
>>
>>
>>
>> I hope it's clear,
>> thank you .
>>
>> Le vendredi 21 octobre 2022 à 09:23:48 UTC+1, Simon King a écrit :
>>
>>> I don't understand the question. Are you saying that only one tag is
>>> displayed? If so, that's not a problem with SQLAlchemy, it's a problem with
>>> your template logic.
>>>
>>> If that's not what you mean, you need to give us more information. What
>>> is the value of "server.tags", and what is the output from the template?
>>>
>>> Simon
>>>
>>> On Thu, Oct 20, 2022 at 9:05 AM Abdellah ALAOUI ISMAILI <
>>> my.ala...@gmail.com> wrote:
>>>
>>>> Hello,
>>>> I call a function in my template that returns sqlalchemy query result,
>>>> (color value from the name of the tag). this is the query function :
>>>>
>>>> *def get_tag_color(name): *
>>>> *return db.session.query(Tag.tag_color).filter(Tag.tag_name ==
>>>> name).scalar() *
>>>>
>>>> and I call it in my template file:
>>>> * {% if server.tags %}*
>>>> * {% for tag in server.tags.split(",") %} *
>>>> * >>> class="label"> {{tag}} *
>>>> * {% endfor %} {% endif %} *
>>>>
>>>> the problem is that I get just one result of the first tag. do you have
>>>> any idea what I miss?
>>>>
>>>> Thank you
>>>>
>>>> --
>>>> SQLAlchemy -
>>>> The Python SQL Toolkit and Object Relational Mapper
>>>>
>>>> http://www.sqlalchemy.org/
>>>>
>>>> To post example code, please provide an MCVE: Minimal, Complete, and
>>>> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
>>>> description.
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "sqlalchemy" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to sqlalchemy+...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/sqlalchemy/4f9d1bab-479d-47d5-89cf-c305026ec3d7n%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/sqlalchemy/4f9d1bab-479d-47d5-89cf-c305026ec3d7n%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>> SQLAlchemy -
>> The Python SQL Toolkit and Object Relational Mapper
>>
>> http://www.sqlalchemy.org/
>>
>> To post example code, please provide an MCVE: Minimal, Complete, and
>> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
>> description.
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "sqlalchemy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to sqlalchemy+...@googlegroups.com.
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sqlalchemy/28c544b5-5445-45f9-ac8e-1dc786984d82n%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/sqlalchemy/28c544b5-5445-45f9-ac8e-1dc786984d82n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/9b2f7e44-b2ff-4288-b02b-3fcc9d9bf170n%40googlegroups.com.