Re: Displaying contrast of a queryset

2024-05-20 Thread Natraj Kavander
hundru < >>>> chundrumanoh...@gmail.com> wrote: >>>> >>>>> print(p) >>>>> >>>>> On Sun, Apr 28, 2024 at 12:25 AM Abdou KARAMBIZI >>>>> wrote: >>>>> >>>>>> H

Re: Displaying contrast of a queryset

2024-05-19 Thread Abdou KARAMBIZI
t_related().all() >>>>> for p in products: >>>>> print(p.product.product_name) >>>>> >>>>> This gives product that has relation in Task model but *I need >>>>> product which doesn't have relation in Task * >>>

Re: Displaying contrast of a queryset

2024-05-03 Thread Abdou KARAMBIZI
ect_related().all() >>>> for p in products: >>>> print(p.product.product_name) >>>> >>>> This gives product that has relation in Task model but *I need product >>>> which doesn't have relation in Task * >>>> >>>&

Re: Displaying contrast of a queryset

2024-05-01 Thread Kelvin Macharia
need product >>> which doesn't have relation in Task * >>> >>> *Means we have products have relations in Task model and others with no >>> relation in Task model and I need a queryset to display those with no >>> relations in Task * >>

Re: Displaying contrast of a queryset

2024-04-30 Thread Kelvin Macharia
ts have relations in Task model and others with no > relation in Task model and I need a queryset to display those with no > relations in Task * > > > > > On Sat, Apr 27, 2024 at 4:57 PM Kelvin Macharia > wrote: > >> Before I share my thoughts here is a ques

Re: Displaying contrast of a queryset

2024-04-28 Thread manohar chundru
doesn't have relation in Task * > > *Means we have products have relations in Task model and others with no > relation in Task model and I need a queryset to display those with no > relations in Task * > > > > > On Sat, Apr 27, 2024 at 4:57 PM Kelvin Macharia > wr

Re: Displaying contrast of a queryset

2024-04-27 Thread Abdou KARAMBIZI
th no relation in Task model and I need a queryset to display those with no relations in Task * On Sat, Apr 27, 2024 at 4:57 PM Kelvin Macharia wrote: > Before I share my thoughts here is a question for you. Where do you expect > your product to be printed out? > > Here is what I thi

Re: Displaying contrast of a queryset

2024-04-27 Thread Kelvin Macharia
rimary_key=True) >> user = models.ForeignKey(User,on_delete = models.CASCADE) >> product = models.ForeignKey(Product,on_delete=models.CASCADE) >> performed_at = models.DateTimeField(auto_now_add=True) >> >> def __int__(self): >>

Re: Displaying contrast of a queryset

2024-04-26 Thread Muhammad Juwaini Abdul Rahman
: > task_id = models.AutoField(primary_key=True) > user = models.ForeignKey(User,on_delete = models.CASCADE) > product = models.ForeignKey(Product,on_delete=models.CASCADE) > performed_at = models.DateTimeField(auto_now_add=True) > > def __int__(self): > retur

Displaying contrast of a queryset

2024-04-26 Thread Abdou KARAMBIZI
to_now_add=True) def __int__(self): return self.task_id *and I have following view with queryset :* def product_task (request): product = Task.objects.select_related().all() for p in product: print(p.product.product_name) *I want to get products don't appear in task model* -

Re: Add single object(most recent) from foreign key relationship to django queryset

2023-05-13 Thread Andrew Kos
some logic in a view > related to Requests off of an attribute in the most recent RequestComment > on a Request and im trying to see if I can add the most recent > RequestComment for reach Request to a request queryset so that i can use > this in a table. > > sample request qu

Re: AttributeError: 'QuerySet' object has no attribute 'mime_type'

2023-01-19 Thread Jason
is `content` a queryset? On Thursday, January 19, 2023 at 8:21:39 AM UTC-5 monisha.s...@ideas2it.com wrote: > @staticmethod > def post(request, *args, **kwargs): > constant = utils.send_grid_key > sg = SendGridAPIClient(constant) > subject = get_subject() > content = get_c

AttributeError: 'QuerySet' object has no attribute 'mime_type'

2023-01-19 Thread Monisha Sivanathan
te-packages\sendgrid\helpers\mail\mail.py", line 80, in __init__ self.add_content(html_content, MimeType.html) File "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\sendgrid\helpers\mail\mail.py", line 734, in add_content if content.mime_type == MimeType.tex

Re: HOW TO OUTPUT DATA GOT FROM combined queryset IN DJANGO TEMPLATE (html file) ?

2023-01-16 Thread Byansi Samuel
Thanks it worked but I would like to ask you, why did you use " game" in {%for game in combined_list %} ? En what is the role of 'game' On Sat, Jan 14, 2023, 8:35 PM Hector Mwaky wrote: > >1. > >In the windows_games view in others/views.py, you are using the >filter() method on the

Re: HOW TO OUTPUT DATA GOT FROM combined queryset IN DJANGO TEMPLATE (html file) ?

2023-01-14 Thread Hector Mwaky
1. In the windows_games view in others/views.py, you are using the filter() method on the Action and Adventure models to get the action and adventure games that have the 'os' field set to 'windows'. Then you are using the itertools.chain() function to combine the two que

HOW TO OUTPUT DATA GOT FROM combined queryset IN DJANGO TEMPLATE (html file) ?

2023-01-12 Thread Byansi Samuel
Hey! Am having a problem. And l request for your Help. Am having 3 apps in Django project - action - adventure - others #action/ models.py class Action(models.Model): name=models.Charfield() os= models.Charfield( choices=OS) #adventure/models.py class Adventure(model

filtering queryset in CreateAPIView view

2022-12-28 Thread Larry Martell
I have a CreateAPIView view with this code in the serializer: class AssignWorkItemSerializer(serializers.Serializer, WorkitemSerializerMixin): assigneeIds = serializers.ListSerializer( child=serializers.PrimaryKeyRelatedField( queryset=get_user_model().objects.filter

Re: Loop through QuerySet in Django

2022-11-04 Thread Marcelo Robin
>> return ctx_history >> >> If I put {{ dates }} in the aside, it returns the following: >> >> > datetime.date(2022, 9, 1), datetime.date(2022, 10, 1)]> >> >> Now I want to go through that queryset, but I can't get what I need: I >> want

Loop through QuerySet in Django

2022-11-02 Thread Marcelo A. Robin
d','month').distinct() return ctx_history If I put {{ dates }} in the aside, it returns the following: Now I want to go through that queryset, but I can't get what I need: I want them to be sorted descending first, that is, the most recent month on top. Se

Warning about filtering queryset in ClassBasedViews

2022-10-19 Thread DaniBoy
Following the example in https://docs.djangoproject.com/en/4.1/topics/class-based-views/generic-display/#viewing-subsets-of-objects I try the following class BookListView(ListView): model = Book queryset = Book.objects.filter(publication_date__lte=timezone.now()) I found that this

Queryset for get all objects with count of some of them.

2022-07-25 Thread Sencer Hamarat
Hi, Is there a way to get all model objects, but including count of some of them within one db transaction. Say, I have this model: class AModel(models.Model): field_choices = ( (0, "a"), (1, "b"), (2, "c") ) field_one = models.CharField(max_length=32) fi

Re: Using a lazy value in a queryset filter?

2022-06-17 Thread Sylvain
2, 2022 at 11:46:44AM -0700, Sylvain wrote: > > Hello, > > > > I’m trying to use the current language of the user in a queryset, but > the > > value gets resolved outside of the request-response cycle. I thought > this > > could work since querysets are lazy, b

Re: Using a lazy value in a queryset filter?

2022-06-12 Thread Ryan Nowakowski
On Sun, Jun 12, 2022 at 11:46:44AM -0700, Sylvain wrote: > Hello, > > I’m trying to use the current language of the user in a queryset, but the > value gets resolved outside of the request-response cycle. I thought this > could work since querysets are lazy, but I guess that d

Using a lazy value in a queryset filter?

2022-06-12 Thread Sylvain
Hello, I’m trying to use the current language of the user in a queryset, but the value gets resolved outside of the request-response cycle. I thought this could work since querysets are lazy, but I guess that doesn’t make the values they use lazy. Here’s an example of what I’m talking about

Facing issue in queryset while creating CRUD API in Django for User Model inherit with AbstractBaseUser

2022-06-01 Thread Mukul Verma
uot;, line 480, in raise_uncaught_exception raise exc File "C:\Users\Mukul Verma\AppData\Local\Programs\Python\Python310\lib\site-packages\rest_framework\views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "C:\WiJungleEps\wijungleapp\views.py"

Re: How to construct nested QuerySet with django ORM?

2022-05-15 Thread Jason
email, I'll just copy a > StackOverFlow link. > > > https://stackoverflow.com/questions/72251670/how-to-construct-nested-queryset-with-django-orm > > Ignoring the `DRF` part, I want to construct an `object` like this, how to > do it? > -- You received this mes

How to construct nested QuerySet with django ORM?

2022-05-15 Thread ivory 954
It's too inconvenient to paste the code in the email, I'll just copy a StackOverFlow link. https://stackoverflow.com/questions/72251670/how-to-construct-nested-queryset-with-django-orm Ignoring the `DRF` part, I want to construct an `object` like this, how to do it? -- You rec

QuerySet Caching of ManyToMany fields

2022-04-21 Thread Russell Melick
Hi All, We've been working on improving the performance of our backend recently, and have started analyzing the database queries generated by Django more thoroughly. We quickly realized that we were mis-using our ManyToMany fields. We had assumed that the results of accessing an M2M field wou

Re: django queryset - Get the data particular to current year only

2022-04-04 Thread Trippy Samurai
Thanks for the reply Brother but it's already solved On Sunday, 3 April 2022 at 12:05:39 UTC+5:30 sutharl...@gmail.com wrote: > I think this is related to your query > https://stackoverflow.com/a/28101722/8882295 > > On Thu, 31 Mar 2022 at 11:22, Trippy Samurai > wrote: > >> >>

Re: django queryset - Get the data particular to current year only

2022-04-02 Thread Lalit Suthar
I think this is related to your query https://stackoverflow.com/a/28101722/8882295 On Thu, 31 Mar 2022 at 11:22, Trippy Samurai wrote: > > > > I have my query written to get some thing from database and display on my > website that query is get

django queryset - Get the data particular to current year only

2022-03-30 Thread Trippy Samurai
I have my query written to get some thing from database and display on my website that query is getting all the data from db but what if i want to get the data particular to current year only def get(self, request, *args, **kwargs): filt

Re: Queryset in settings.py?

2022-01-28 Thread Fabio C. Barrionuevo da Luz
Now when a endcustomer open this view then this view get template from > /templates/newtemplate/Testtemplate.html. How can archive this? > > Thank you very much > > Am Sa., 29. Jan. 2022 um 00:14 Uhr schrieb Fabio C. Barrionuevo da Luz < > bna...@gmail.com>: > >> Hi

Re: Queryset in settings.py?

2022-01-28 Thread Sebastian Jung
chrieb Fabio C. Barrionuevo da Luz < bna...@gmail.com>: > Hi Sebastian, I guess this is not possible. > > But the real question is: why do you need a queryset to perform in the > settings? > > Perhaps if you explain what problem you want to solve, we can give you > some opt

Re: Queryset in settings.py?

2022-01-28 Thread Fabio C. Barrionuevo da Luz
Hi Sebastian, I guess this is not possible. But the real question is: why do you need a queryset to perform in the settings? Perhaps if you explain what problem you want to solve, we can give you some options for other possible solutions. Em sex., 28 de jan. de 2022 às 20:00, sebasti

Queryset in settings.py?

2022-01-28 Thread sebasti...@gmail.com
Hello, i want to import from a app models.py like this: from app1.models import classname then i get: django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. I want to get a queryset from app1.models.classname in settings.py. How is this possible? Regards -- You received

Re: What is the difference bulk_update() and update() in django queryset.

2021-08-18 Thread M. GW
bulk_update() is a method that updates the provided list of objects into the database with one query. and update() is just for one object ambiti...@gmail.com schrieb am Donnerstag, 12. August 2021 um 00:03:25 UTC+2: > What is the difference bulk_update() and update() in django query

What is the difference bulk_update() and update() in django queryset.

2021-08-11 Thread Am bition
What is the difference bulk_update() and update() in django queryset. -- 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...@google

How do I return a queryset of all items (X) ManyToMany related to model class (Y) and include values for (Y) in the same result in each item X

2021-07-05 Thread mtp...@gmail.com
;Nairobi", 'objection_no': "pv876646", 'ratable_owner': True, 'ratable_relation': "N/A" } ] ``` I attempted this implementation but its not the most effective way to do so considering when data eventually grows (I tried this when

Re: using .annotate on a queryset and output field is a result of function

2021-06-28 Thread VISHESH MANGLA
es")*F("price_per_share")).values('total_price') >>>> On Thursday, 17 June 2021 at 03:23:01 UTC+5:30 VISHESH MANGLA wrote: >>>> >>>>> Hello, >>>>> >>>>> I wanted to know that how for the model below, how can I get a

Re: using .annotate on a queryset and output field is a result of function

2021-06-17 Thread Nikeet NA
w that. >>> >>> TransactionEntry.objects.defer("users").annotate(total_price=F("num_shares")*F("price_per_share")).values('total_price') >>> On Thursday, 17 June 2021 at 03:23:01 UTC+5:30 VISHESH MANGLA wrote: >>> >>>> H

Re: using .annotate on a queryset and output field is a result of function

2021-06-17 Thread Nikeet NA
t allow that. >> >> TransactionEntry.objects.defer("users").annotate(total_price=F("num_shares")*F("price_per_share")).values('total_price') >> On Thursday, 17 June 2021 at 03:23:01 UTC+5:30 VISHESH MANGLA wrote: >> >>> Hello,

Re: using .annotate on a queryset and output field is a result of function

2021-06-17 Thread VISHESH MANGLA
ers").annotate(total_price=F("num_shares")*F("price_per_share")).values('total_price') > On Thursday, 17 June 2021 at 03:23:01 UTC+5:30 VISHESH MANGLA wrote: > >> Hello, >> >> I wanted to know that how for the model below, how can I get a queryset

Re: using .annotate on a queryset and output field is a result of function

2021-06-16 Thread Nikeet NA
> Hello, > > I wanted to know that how for the model below, how can I get a queryset > with all the fields excluding the `user` and including the output of > get_output_field? Please avoid hardcoding. > One way is > > `TransactionEntry > .objects.defer("users&qu

using .annotate on a queryset and output field is a result of function

2021-06-16 Thread VISHESH MANGLA
Hello, I wanted to know that how for the model below, how can I get a queryset with all the fields excluding the `user` and including the output of get_output_field? Please avoid hardcoding. One way is `TransactionEntry .objects.defer("users").annotate(total_price=F("

Re: QuerySet performance on large datasets

2021-04-11 Thread Peter of the Norse
taff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user"; args=() (0.000) SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user&q

Re: QuerySet performance on large datasets

2021-02-12 Thread Peter of the Norse
bool(qs) is recommended when the queryset has already been run. If you do something like val = qs.earliest(some_property) if bool(qs) else None then there isn’t a performance gain because it still has to run qs.exists() to even see if there is a value. Later things like that will be

Re: muliple queryset result

2021-01-15 Thread Naresh Jonnala
> > Actually I have one *Primary *Table called *CustomUser *and I'm extending > this model as *Foreign *Key in *UserContactDetails model*. So now > basically *one user have multiple contact details.* But whenever I'm > applying *filter *on *Primary Table field* as well a

QuerySet performance on large datasets

2021-01-12 Thread 'Juergen H' via Django users
Dear django users, when working on very large datasets (millions of items) and performing queries on it, I have a few questions regaring the performance. - From my understanding using `bool(qs)` is preferred over using `qs.exists()` when the queryset is used later on, as `bool(qs

Re: ForeignKey with different queryset from manager

2021-01-10 Thread Peter of the Norse
(Member, related_name='+', null=True, > blank=True, on_delete=models.CASCADE) > > Do something like this: > > ref_member = models.ForeignKey(Member, queryset=Member.all_objects.all(), > related_name='+', null=True, blank=True, on_delete=models.CASCADE) > >

muliple queryset result

2021-01-09 Thread Soumen Khatua
Key table* field, this queryset is returnning multiple Object inside queryset, like If my *ContactDetails *have 3 numbers of record for a user then it's returning the same record 3 number of times inside queryset, can you guys tell me, How can I solve this problem? I almost spend three hours on it,

Re: Django Admin, how to update select user field with my own queryset after adding new foreign object

2021-01-08 Thread Mike Dewhirst
', ) list_filter= ('asigned_seller', 'is_close', 'created_at', 'deadline', ) ordering= ['-deadline'] search_fields= ['name'] actions= [close_personal_warehouses] def formfield_for_fore

ForeignKey with different queryset from manager

2020-12-14 Thread Jimmy Gawain
SCADE) Do something like this: ref_member = models.ForeignKey(Member, *queryset=Member.all_objects.all()*, related_name='+', null=True, blank=True, on_delete=models.CASCADE) Is there any way to do the equivalent of this? thanks -- You received this message because you are subscribed

Re: Django Queryset

2020-12-13 Thread Jorge Gimeno
On Sun, Dec 13, 2020 at 7:21 PM MAMADOU KANTE wrote: > Hi to everybody; > I have been trying to deploy an app through heroku for the past 7 days but > whenever I reach the final stage I receive a rejection message. > The message tells me the module "skbuild" was not imported or I should > upgrad

Re: Django Queryset

2020-12-13 Thread MAMADOU KANTE
;> >> *'info__date_of_transaction__year', >> 'info__country_destination__continent'* >> *).annotate(volume=Sum('volume')* >> *).order_by('info__country_destination__continent'* >>

Re: Django Queryset

2020-11-04 Thread Walter Randazzo
te_of_transaction__year', > 'info__country_destination__continent'* > *).annotate(volume=Sum('volume')* > *).order_by('info__country_destination__continent'* > > *).filter(info__date_of_transaction__range=["2019-01-01", "202

Django Queryset

2020-11-04 Thread lada...@gmail.com
volume')* *).order_by('info__country_destination__continent'* *).filter(info__date_of_transaction__range=["2019-01-01", "2020-12-31"])* and this Queryset: * 2019 2020 2020 2020* Please how do use it in the template to get something like this, [image: Capture.PNG] -- You received

Re: Django queryset filtering

2020-10-11 Thread Dvs Khamele
Hi do you hire contract based python/django freelancer? We can help you in this and related tasks at fair prices. Reply or send email to divy...@pythonmate.com Best Regards, Divyesh Khamele, Pythonmate On Thu, 25 Jun 2020, 3:55 am mtp...@gmail.com, wrote: > I have a queryset that returns

Re: Django queryset filtering

2020-10-06 Thread mtp...@gmail.com
LicenseIssue.objects.filter(expiry_date__lte=TODAY).exclude(business_id__in=active_business_ids).order_by('-expiry_date')* > > On Wednesday, June 24, 2020 at 6:25:18 PM UTC-4 mtp...@gmail.com wrote: > >> I have a queryset that returns all the expired licenses objects as s

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-31 Thread RANGA BHARATH JINKA
No problem. All the best 😀 On Mon, Aug 31, 2020 at 11:35 PM Patrick Carra wrote: > Thanks bharath for the info I'm going to dig more in to these. > > On Friday, August 28, 2020 at 9:05:04 PM UTC-5 bharath...@gmail.com wrote: > >> Hi, >> >> Please check this package. This may help you. All th

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-31 Thread Patrick Carra
Thanks bharath for the info I'm going to dig more in to these. On Friday, August 28, 2020 at 9:05:04 PM UTC-5 bharath...@gmail.com wrote: > Hi, > > Please check this package. This may help you. All the best > > https://django-tables2.readthedocs.io/en/latest/pages/filtering.html >

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-31 Thread Patrick Carra
*Thanks coolguy I changed my urls.py to this and that resolved the error:* from django.urls import include, path from . import views from .views import search app_name= "searchLit" urlpatterns=[ path('customsearch/', views.search, name='search'), path('exportlit/', views.searchLit_export

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-29 Thread V. J
nsions/buttons/examples/initialisation/export.htmlOn Sat, 29 Aug 2020, 7:54 am RANGA BHARATH JINKA, <bharathjink...@gmail.com> wrote:Hi,     Check this.      https://pypi.org/project/django-queryset-csv/On Sat, 29 Aug 2020, 7:33 am RANGA BHARATH JINKA, <bharathjink...@gmail.com> wrote:

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-28 Thread coolguy
You can't have the same name twice. You need to change the name for one of the followings: path('customsearch/', views.search, name='search'), path('customsearch//', views.search, name='search_xxx') Reverse method requires a url identified by name parameter which must be unique. Its look

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-28 Thread coolguy
You can't have the same name twice. You need to change the name for one of the followings: path('customsearch/', views.search, name='search'), path('customsearch//', views.search, name='search_xxx') On Friday, August 28, 2020 at 7:06:09 PM UTC-4 pcar...@gmail.com wrote: > Hello All! I n

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-28 Thread RANGA BHARATH JINKA
o. > > https://datatables.net/extensions/buttons/examples/initialisation/export.html > > On Sat, 29 Aug 2020, 7:54 am RANGA BHARATH JINKA, < > bharathjink...@gmail.com> wrote: > >> Hi, >> >> Check this. >> https://pypi.org/project/django-queryset-cs

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-28 Thread RANGA BHARATH JINKA
; https://pypi.org/project/django-queryset-csv/ > > > On Sat, 29 Aug 2020, 7:33 am RANGA BHARATH JINKA, < > bharathjink...@gmail.com> wrote: > >> Hi, >> >> Please check this package. This may help you. All the best >> >> https

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-28 Thread RANGA BHARATH JINKA
Hi, Check this. https://pypi.org/project/django-queryset-csv/ On Sat, 29 Aug 2020, 7:33 am RANGA BHARATH JINKA, wrote: > Hi, > > Please check this package. This may help you. All the best > > https://django-tables2.readthedocs.io/en/latest/pages/filtering.ht

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-28 Thread RANGA BHARATH JINKA
Hi, Please check this package. This may help you. All the best https://django-tables2.readthedocs.io/en/latest/pages/filtering.html On Sat, 29 Aug 2020, 4:36 am Patrick Carra, wrote: > Hello All! I need some help with a problem I have been struggling with. > One of you generous geniu

NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-28 Thread Patrick Carra
Hello All! I need some help with a problem I have been struggling with. One of you generous geniuses has the answer I'm sure of it. I am working on integrating an export to csv button(link) on my template to export filtered data from one of my tables. I have previously only been able to dum

Re: Django jinja queryset filter lenth

2020-08-12 Thread N'BE SORO
thank you Le dim. 9 août 2020 à 09:12, Liu Zheng a écrit : > Hi, > > Not sure it's a good idea to do database query inside the template. > Templates are capable of running some logics but for a heavy-lifting job > like database query, it should be a good practice to do it in the view, and > only

Re: Django jinja queryset filter lenth

2020-08-09 Thread Liu Zheng
Hi, Not sure it's a good idea to do database query inside the template. Templates are capable of running some logics but for a heavy-lifting job like database query, it should be a good practice to do it in the view, and only pass the results to the template. On Sun, Aug 9, 2020 at 4:30 AM Agoua

Re: Django jinja queryset filter lenth

2020-08-08 Thread Agoua David
As Django template engine do not support the parenthèses you Can try to make a custom filter Le sam. 8 août 2020 à 20:27, Agoua David a écrit : > You Can try to use .count instead > > Le sam. 8 août 2020 à 17:56, N'BE SORO a écrit : > >> Good evening please >> >> Can you help me? >> >> I want t

Re: Django jinja queryset filter lenth

2020-08-08 Thread Agoua David
You Can try to use .count instead Le sam. 8 août 2020 à 17:56, N'BE SORO a écrit : > Good evening please > > Can you help me? > > I want to display the number of items with a filter. > Example: > this call returns 4 elements > {{ item.class.classecours.all|length}} > > at the .all level > make a

Django jinja queryset filter lenth

2020-08-08 Thread N'BE SORO
Good evening please Can you help me? I want to display the number of items with a filter. Example: this call returns 4 elements {{ item.class.classecours.all|length}} at the .all level make an item.class.classecours.filter(status==True)|length -- You received this message because you are subsc

Make the Right Queryset

2020-07-09 Thread Ha
hello django users ! I don't know how to do the right queryset, to get total mail have status='affecté' in the same date I used a queryset like this : Evenement.objects.annotate(Day=TruncDay('date_Evt')).values('Day')\ .annotate(affecte=Count('

Re: How to get names of columns from QuerySet without executing it

2020-07-08 Thread Dvil Djé
For a light version of the query, you can try a qs.first() as Django will limit the SQL request to the first element. On Saturday, July 4, 2020 at 10:11:41 PM UTC+2, Eugene Kulak wrote: > > How to get names of columns from QuerySet without executing it? > If it is not possible what wou

Re: How to get names of columns from QuerySet without executing it

2020-07-06 Thread Eugene Kulak
Michael, this will not work for cases with `values` and `annotations` On Sunday, July 5, 2020 at 2:23:03 PM UTC-4, michaelfladischer wrote: > > What about introspecting the model associated with the QuerySet: > > qs = SomeModel.objects.all() > columns = [f.column for f in qs.mod

Re: How to get names of columns from QuerySet without executing it

2020-07-05 Thread Michael Fladischer
What about introspecting the model associated with the QuerySet: qs = SomeModel.objects.all() columns = [f.column for f in qs.model._meta.fields] Regards, Michael Am 04.07.2020 um 22:11 schrieb Eugene Kulak: How to get names of columns from QuerySet without executing it? If it is not

Re: How to get names of columns from QuerySet without executing it

2020-07-04 Thread Eugene Kulak
of columns from QuerySet without executing it? > If it is not possible what would be the most easier way to execute a > lighter version of the query. > The query itself is unknown, it could be anything. > -- You received this message because you are subscribed to the Google Grou

Re: How to get names of columns from QuerySet without executing it

2020-07-04 Thread Eugene Kulak
, Jul 5, 2020 at 10:12 AM Eugene Kulak > > wrote: >> >>> How to get names of columns from QuerySet without executing it? >>> If it is not possible what would be the most easier way to execute a >>> lighter version of the query. >>> The query it

Re: How to get names of columns from QuerySet without executing it

2020-07-04 Thread Eugene Kulak
Thank you, Stephen, but this is not what I asked. I can't change QuerySet and I don't know how it looks like. On Saturday, July 4, 2020 at 4:30:40 PM UTC-4, Akinfolarin Stephen wrote: > > you can filter out the column you want by using > [name of model].objects.get(filter=

Re: How to get names of columns from QuerySet without executing it

2020-07-04 Thread Vishesh Mangla
he column you want by using > [name of model].objects.get(filter=[name of the column you want]) > > On Sun, Jul 5, 2020 at 10:12 AM Eugene Kulak > wrote: > >> How to get names of columns from QuerySet without executing it? >> If it is not possible what would be the mos

Re: How to get names of columns from QuerySet without executing it

2020-07-04 Thread Akinfolarin Stephen
you can filter out the column you want by using [name of model].objects.get(filter=[name of the column you want]) On Sun, Jul 5, 2020 at 10:12 AM Eugene Kulak wrote: > How to get names of columns from QuerySet without executing it? > If it is not possible what would be the most easier

How to get names of columns from QuerySet without executing it

2020-07-04 Thread Eugene Kulak
How to get names of columns from QuerySet without executing it? If it is not possible what would be the most easier way to execute a lighter version of the query. The query itself is unknown, it could be anything. -- You received this message because you are subscribed to the Google Groups

Re: Django queryset filtering

2020-06-26 Thread Dan Madere
y, June 24, 2020 at 6:25:18 PM UTC-4 mtp...@gmail.com wrote: > I have a queryset that returns all the expired licenses objects as shown > below. > > > *qs = > LicenseIssue.objects.filter(expiry_date__lte=TODAY).order_by('-expiry_date')* > > > Here is my situat

Re: Django queryset filtering

2020-06-25 Thread Oleg Kishenkov
Hello, use a filtering chain, a refined queryset is itself a queryset so you can filter it further. Also, Django has extensive lookup support in its filtering methods. Let's assume LicenseIssue is related to Business as many to one (it is probably the case): class Business(models.Model):

Django queryset filtering

2020-06-24 Thread mtp...@gmail.com
I have a queryset that returns all the expired licenses objects as shown below. *qs = LicenseIssue.objects.filter(expiry_date__lte=TODAY).order_by('-expiry_date')* Here is my situation: There exists multiple issued licenses of different businesses for year 2020 and their previ

Understanding timezone with queryset day lookups

2020-06-09 Thread Ryan Causey
I ran into what I consider somewhat surprising behavior the other day when using the `__date` lookup to compare a datetime to a date in a queryset. It appears according to these docs that the Queryset will convert the datetime value in the DateTimeField to the current timezone before comparing

Re: problem filtering queryset in Django Rest Framework

2020-06-07 Thread wongX Ndeso
eldLookupMixin(object): > """ > Apply this mixin to any view or viewset to get multiple field filtering > based on a `lookup_fields` attribute, instead of the default single > field filtering. > """ > def get_object(self): >

problem filtering queryset in Django Rest Framework

2020-06-06 Thread Agnese Camellini
to any view or viewset to get multiple field filtering based on a `lookup_fields` attribute, instead of the default single field filtering. """ def get_object(self): queryset = self.get_queryset() # Get the base queryset queryset = self.filter_q

Additional column in Queryset with condition

2020-05-23 Thread Saurabh Adhikary
Hello , I need some advice / tips. I am in a fix. I have 2 databases & I want to join 2 tables of that. *As we know the foreign key concept with 2 separate databases is not possible. * Basically what I want is to add a custom column to a queryset and pass the *current row.name &

Need help in Django calculated field/queryset

2020-04-30 Thread Jay Prajapati
Hello everyone, Still stucked on this pointHas anyone tried it? -- 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. T

Need help in Django calculated field/queryset

2020-04-18 Thread Jay Prajapati
ld use previous transaction's calculated WAP. Here are the codes i have tried through queryset to derived by not worked exactly I wanted. all_txn =eq_txn.objects.annotate(cumqty=Window(Sum(Case(When(deal_type='Buy', then='quantity'), When(deal_type='Sell', then=

Need help in Django calculated field/queryset

2020-04-18 Thread Jay Prajapati
alculated WAP. Here are the codes i have tried through queryset to derived by not worked exactly I wanted. all_txn =eq_txn.objects.annotate(cumqty=Window(Sum(Case(When(deal_type='Buy', then='quantity'), When(deal_type='Sell', then=F('quantity')*-1))), p

WYSIWYG Editor with editable queryset (like Confluence)

2020-02-29 Thread guettli
Some days ago I worked with Confluence. This tool has a great feature: You can insert a paginated queryset in a page. Without coding, all WYSIWYG: Docs: https://confluence.atlassian.com/doc/page-properties-report-macro-186089616.html Is there a way to get this cool feature into django

Re: Django values_list queryset returns queryset object instead of list

2020-02-28 Thread Andréas Kühne
HI Santhosh, This is expected behaviour because it is a queryset until you query the results - or iterate over them. For example: for item in View.objects.all().values_list('name',flat=True).order_by('id'): print(item) will iterate over the list of values. BUT if you want

Related Queryset filter

2020-02-26 Thread Malik Brahimi
class GridViewset(ModelViewSet): queryset = Grid.objects.all() serializer_class = GridSerial class ItemViewset(ModelViewSet): queryset = Item.objects.all() serializer_class = ItemSerial def get_queryset(self): if self.request.user.is_staff: return

Django values_list queryset returns queryset object instead of list

2020-02-26 Thread Santhosh sridhar
Hi, I have a table named View, I'm filtering values like this : views = View.objects.all().values_list('name',flat=True).order_by('id') I get the output as instead of list of the names. So I face error when try to parse it in jquery : jQuery.parseJSON(JSON.stringify("{{views|safe}}".replace(/'/

Re: Django queryset result and mysql query are wrong after updating from 3.0.2 to 3.0.3

2020-02-19 Thread mohamed alisaleh...@gmail.com
بتاريخ الأربعاء، 19 فبراير، 2020 10:51:53 م UTC+3، كتب Ricardo H: > Hi Simon,  > > > It was ok on 2.2.6, only on 3.0.3 it fails. > > > I use BigIntegerField because I use it for some calculations after that, but > even if I try with DurationField it doens't assert right. > > > Definitely mus

Re: Django queryset result and mysql query are wrong after updating from 3.0.2 to 3.0.3

2020-02-19 Thread Simon Charette
Hello Ricardo, I suggest you follow these docs to submit your bug report and link to this thread. https://docs.djangoproject.com/en/3.0/internals/contributing/bugs-and-features/#reporting-bugs I'd mention that the issue is also present if you use `output_field=DurationField` as BigIntegerField

  1   2   3   4   5   6   7   8   9   10   >