Django Admin Dropdown Filtering: Show Exam Class Related Students in Student Assign Field

2023-09-01 Thread Sabbir Hasan Munna
https://stackoverflow.com/q/77018469/9885741 -- 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 view this discussion o

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(userr

Warning about filtering queryset in ClassBasedViews

2022-10-19 Thread DaniBoy
this query filter by the date the server was started. So the solution is to use a dynamic filtering. Could be a good idea to include some warning about this in the documentation? I have tried to find some information but I did not find anything. -- You received this message because yo

Re: Negated filtering by lookup expression sent via url query

2022-05-31 Thread Lalit Suthar
you can write custom filtering classes and methods using Django filters. There you can define fields and methods according to your use case example: https://stackoverflow.com/questions/43009538/use-custom-filter-with-django-modelchoice-filter On Tue, 31 May 2022 at 19:16, Sencer Hamarat wrote

Negated filtering by lookup expression sent via url query

2022-05-31 Thread Sencer Hamarat
Hi, Is there any way to negate filtering with the django-filter package which lookup expression sent via url query, such as: http://example.com/?name__not_contains=john The request above has to be passed through the django filterset class and the class has to be returned with the queryset

Re: Filtering by custom UUIDField got broken with Django 3.2 upgrade

2022-05-05 Thread Michael Powell
valid'] % {'value': > value}) > > if connection.features.has_native_uuid_field: > return value > return str(value) > > Now the problem introduced with 3.2 is that filtering by this field > doesn't work properly. If I try to f

Re: Filtering by custom UUIDField got broken with Django 3.2 upgrade

2022-05-05 Thread Jason
try: >> value = uuid.UUID(value) >> except AttributeError: >> raise TypeError(self.error_messages['invalid'] % >> {'value': value}) >> >> if connection.features.has_native_uuid_field: >>

Re: Filtering by custom UUIDField got broken with Django 3.2 upgrade

2022-05-05 Thread Jason
D): > try: > value = uuid.UUID(value) > except AttributeError: > raise TypeError(self.error_messages['invalid'] % {'value': > value}) > > if connection.features.has_native_uuid_field: > r

Fwd: Filtering by custom UUIDField got broken with Django 3.2 upgrade

2022-05-04 Thread Milán Boleradszki
try: value = uuid.UUID(value) except AttributeError: raise TypeError(self.error_messages['invalid'] % {'value': value}) if connection.features.has_native_uuid_field: return value return str(value) Now the proble

Re: Filtering User Data/Records

2022-04-15 Thread Ryan Nowakowski
On Thu, Apr 07, 2022 at 01:08:19PM +0300, tech george wrote: > I am trying to filter my medicine stock data so that Pharmacist 1 can only > view their records but not Pharmacist 's 2 records. > > So far nothing is filtered and all the pharmacists can see all the > available records, Please advise

date filtering in with __gte does not add apostrophe

2021-06-29 Thread safhac
when filtering using __gte on models.DateTimeField the printed query doesn't wrap the searched date with an apostrophe ' this may lead to undesired results in postgres database: WHERE ("appname_tablename"."creation_date" >= *2021-06-27 11:08:29.311284+00:00*

Re: Filtering fields in http response data from http request url ?

2021-05-31 Thread Sam Chaffy
Using django rest framework, create a serializer class and specify the right field you want to display at the end. Please check this link https://www.django-rest-framework.org/api-guide/serializers/ On Sun, May 30, 2021 at 10:03 PM Mottaz Hegaze wrote: > Using Django Rest Framework , you can

Re: Filtering fields in http response data from http request url ?

2021-05-30 Thread Mottaz Hegaze
Using Django Rest Framework , you can alter the output by overriting function to_represent in serializer. On Mon, 31 May 2021, 1:26 am Adaeit Telle, wrote: > Hi Django Developers, > Json response from the django server is huge as the data fields contained > are of big size. > So, can I restrict

Filtering fields in http response data from http request url ?

2021-05-30 Thread Adaeit Telle
Hi Django Developers, Json response from the django server is huge as the data fields contained are of big size. So, can I restrict the *fields* required in the response data from the *HTTP Request Url* ? Is there a generic param, which can be used ? Just like QuerySet, can we have "ValueSet"

Re: Filtering OR-combined queries

2021-05-12 Thread Shaheed Haque
Just to close the loop on this, the defect in https://code.djangoproject.com/ticket/32717 is on its way to being resolved, but my original reason for using OR'd queries rather than Q() expressions was that I had not quite grokked the use of ~Q() to implement .exclude(). Simon kindly pointed out the

I need help with getting latest object after filtering

2021-05-10 Thread Francis Akabo
Hi Everyone! I am working on a project that is supposed to allow users to transfer files amongst each other. A transferred file can only be viewed by the user to whom the file has been transferred or an is_staff account. *My Model* class File(models.Model): TYPES = ( ('GENERAL', 'General'), ('PE

Re: Filtering OR-combined queries

2021-05-05 Thread Shaheed Haque
After testing with 3.2.1, I filed https://code.djangoproject.com/ticket/32717. On Tue, 4 May 2021 at 13:23, Shaheed Haque wrote: > Simon, > > Thanks for the heads up. At first glance, the release notes don't *quite* > seem to match what I see but as you suggest, I will certainly check the new >

Re: Filtering OR-combined queries

2021-05-04 Thread Shaheed Haque
Simon, Thanks for the heads up. At first glance, the release notes don't *quite* seem to match what I see but as you suggest, I will certainly check the new release before filing an issue. TTFN, Shaheed On Mon, 3 May 2021 at 16:10, Simon Charette wrote: > Hello Shaheed, > > I didn't look at yo

Re: Filtering OR-combined queries

2021-05-03 Thread Simon Charette
Hello Shaheed, I didn't look at your issue into details but since it involves exclude, subqueries, an queryset combination and only manifests itself on Django 3.2 I wouldn't be surprised if it was related to some regressions in this area that are fixed in Django 3.2.1 which is meant to be relea

Re: Filtering OR-combined queries

2021-04-30 Thread Shaheed Haque
Hi, On Fri, 30 Apr 2021 at 11:52, Sebastian Jung wrote: > Take q for or Filterung: > > > https://stackoverflow.com/questions/6567831/how-to-perform-or-condition-in-django-queryset > Thanks for the response, but the OR is not the problem: it works just fine. (FWIW, I used the "|" form rather tha

Re: Filtering OR-combined queries

2021-04-30 Thread Sebastian Jung
Take q for or Filterung: https://stackoverflow.com/questions/6567831/how-to-perform-or-condition-in-django-queryset Shaheed Haque schrieb am Fr., 30. Apr. 2021, 02:43: > Hi, > > I have a query which ORs some selects on a single table together like this: > > jurisdiction = 'aaa' > qs = Buss.obje

Filtering OR-combined queries

2021-04-29 Thread Shaheed Haque
Hi, I have a query which ORs some selects on a single table together like this: jurisdiction = 'aaa' qs = Buss.objects.filter(jurisdiction=jurisdiction) qs = qs | Buss.objects.filter(jurisdiction='xxx').exclude(name__in =qs.values_list('name', flat=True)) qs = qs | Buss.objects.filter(jurisdictio

Dashboard Drag and Drop with individual filtering

2021-04-10 Thread sebasti...@gmail.com
this setting is also loaded. Also i want that user can make settings like when a listview is created then a small settings icon in widget is shown and user make settings like which model ist shown and also filtering like createdate last 14 days. Have anyone a idea how can i create such

Re: Filtering serializermethodfield in DRF

2021-02-24 Thread shreeh...@gmail.com
Okay, thanks for the help. On Wednesday, February 24, 2021 at 10:22:51 AM UTC+5:30 kunalsol...@gmail.com wrote: > I don't the exact use case here, but you can pass context while passing > data to specializer.And then use it inside creializer clas by self.context. > In this case you can pass quer

Re: Filtering serializermethodfield in DRF

2021-02-23 Thread Kunal Solanke
I don't the exact use case here, but you can pass context while passing data to specializer.And then use it inside creializer clas by self.context. In this case you can pass query params to context On Wed, Feb 24, 2021, 10:15 shreeh...@gmail.com wrote: > I have to filter my queryset based on a q

Filtering serializermethodfield in DRF

2021-02-23 Thread shreeh...@gmail.com
I have to filter my queryset based on a query param. I have to filter based on serializermethodfield. Any help would be appreciated. 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

RES: Filtering combobox according to a project list created by logged user

2020-10-26 Thread Samuel Nogueira
21:45Para: Django usersAssunto: Filtering combobox according to a project list created by logged user Hi everyone! I am newbe in Django and I have a question.  I am creating a multi-tenanci application and I need to filter the combobox according to projects created by logged users, but I have the followi

Filtering combobox according to a project list created by logged user

2020-10-25 Thread Gabriel
Hi everyone! I am newbe in Django and I have a question. I am creating a multi-tenanci application and I need to filter the combobox according to projects created by logged users, but I have the following message: *AttributeError at /requisitos/cadastrarRequisito/ 'WSGIRequest' object has no

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 all th

Re: Django queryset filtering

2020-10-06 Thread mtp...@gmail.com
Thanks guys this was very useful On Friday, June 26, 2020 at 6:27:23 PM UTC+3 Dan Madere wrote: > I'd make two queries. One to see which businesses currently have active > licenses, then a second to get the expired licenses, excluding the > businesses from the first query. Here's some example

Filtering Display

2020-09-15 Thread dopej...@gmail.com
Please I want to add a filter to my django template that displays media files such that users can select what sort of file is displayed by selecting by file extension. Please whats the best way to achieve this? -- You received this message because you are subscribed to the Google Groups "Djang

Re: Filtering ChoiceField by Multiple id's and same value ('name')

2020-08-29 Thread Yvonne Calhoun Pasquali
Correction: ModelChoiceFields are ChoiceFields. I was going to use ModelChoiceFields, but am unsure whether it is better to use querysets rather than ChoiceFields. On Saturday, August 29, 2020 at 7:43:47 PM UTC-6 Yvonne Calhoun Pasquali wrote: > Hello, > > I have a form with three fields (1

Filtering ChoiceField by Multiple id's and same value ('name')

2020-08-29 Thread Yvonne Calhoun Pasquali
Hello, I have a form with three fields (1 Choicefield and 2 ModelChoicefields): The Choicefield displays names of objects by id's. However, in my db, I have multiple objects with the same name. I am trying to filter these objects by "species" and "gender" (the two ModelChoiceFields). I would

Re: Django queryset filtering

2020-06-26 Thread Dan Madere
I'd make two queries. One to see which businesses currently have active licenses, then a second to get the expired licenses, excluding the businesses from the first query. Here's some example code, assuming the LicenseIssue model has a "business" foreign key field: *active_business_ids = Licen

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 previous issued

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

How to use filtering data while using distinct method in django?

2020-01-16 Thread kaito
please visit this site for more info https://stackoverflow.com/questions/59764028/how-to-use-filtering-data-while-using-distinct-method-in-django I hope my title is enough to understand what I mean, please help me on this problem guys. [image: data.PNG] When I tried this: "&quo

Re: New release of django-ai: Spam Filtering systems

2020-01-02 Thread straight 55b
dme.html > > The main exciting features of this version are Spam Filtering systems and > Classification with Support Vector Machines ready to be plugged into any > Django application. > Spam Filtering > > This *system* uses the scikit-learn framework <http://scikit-learn.org&g

Filtering ModelChoiceField for InlineFormset

2019-09-26 Thread IWilliams
Hi, I would like to use ModelChoiceField in the following ways: models.py class Project(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True, blank=True) ... class Profile(models.Model): project = models.ForeignKey(Project, on_delete=model

Help filtering choice_set based on size of set in Django Tutorial

2019-07-09 Thread James Boulger
Hello, I am posting because I am working on the Django documentation tutorials and am currently on the testing portion (https://docs.djangoproject.com/en/2.2/intro/tutorial05/). In this tutorial where we are building the polls application, there is a portion where we wish to restrict what page

Re: Filtering Data Based On Foreign Key

2019-05-23 Thread Simon A
Have you tried putting the load_price() code inside the init code? like def __init__(self, *args, **kwargs): super(PlayerRegistrationForm, self).__init__(*args, **kwargs) self.fields['club_id'].widget = forms.HiddenInput() membership = request.GET.get('membership_title')

Filtering Data Based On Foreign Key

2019-05-21 Thread Gavin Boyle
Hi all, I am having an issue dynamically populating form data based on the previous selected field. In my case I have two models one which contains different types of memberships associated to different clubs. Then I have another model which handles registrations for individual clubs. My problem

Filtering choices in a form based on previous field selection

2019-04-07 Thread Gavin Boyle
Hi all, Just quickly to summarize I have an app, which allows clubs to sign up and carry out different tasks. One of the features is a scheduling / rosters. Currently I have a form to add times to the roster. The club pages work off a session key based on the initially selected club. My form cons

Re: filtering and searching help - regarding

2019-02-03 Thread Shashank Singh
Can you give an example. On Sun, 3 Feb, 2019, 7:49 PM Mohan Goud here the problem is, i can't give sectionname, dept and year directly. It > has to do it for all sections in the database. can u help me how to do this. > > > > On Sun, Feb 3, 2019 at 7:41 PM Shashank Singh < > shashank.singh10...@g

Re: filtering and searching help - regarding

2019-02-03 Thread Mohan Goud
yes render response but i have to store the sorted version in some other model by creating it dynamically. -- 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

Re: filtering and searching help - regarding

2019-02-03 Thread Mohan Goud
here the problem is, i can't give sectionname, dept and year directly. It has to do it for all sections in the database. can u help me how to do this. On Sun, Feb 3, 2019 at 7:41 PM Shashank Singh wrote: > Student.objects.filter(section__iexact="a", > department=1,year=2019).order_by("name") >

Re: filtering and searching help - regarding

2019-02-03 Thread Shashank Singh
Student.objects.filter(section__iexact="a", department=1,year=2019).order_by("name") On Sun, 3 Feb, 2019, 7:32 PM Mohan Goud django > > > > On Sun, Feb 3, 2019 at 7:30 PM Birol Demirtaş > wrote: > >> Django ? Or ? >> >> 3 Şub 2019 Paz, saat 16:59 tarihinde Mohan Goud < >> kathi.mohang...@gmail.c

Re: filtering and searching help - regarding

2019-02-03 Thread Birol Demirtaş
Wnat u want ask to database ? Example X = yourmodel.objects.all() Context = {‘x’:x} Return render (request,your.html,context) 3 Şub 2019 Paz, saat 17:02 tarihinde Mohan Goud şunu yazdı: > django > > > > On Sun, Feb 3, 2019 at 7:30 PM Birol Demirtaş > wrote: > >> Django ? Or ? >> >> 3 Şub 20

Re: filtering and searching help - regarding

2019-02-03 Thread Mohan Goud
django On Sun, Feb 3, 2019 at 7:30 PM Birol Demirtaş wrote: > Django ? Or ? > > 3 Şub 2019 Paz, saat 16:59 tarihinde Mohan Goud > şunu yazdı: > >> >> >> students list is in database. I have to search based on section, >> department and year and sort them in ascending order. can any one help m

Re: filtering and searching help - regarding

2019-02-03 Thread Birol Demirtaş
Django ? Or ? 3 Şub 2019 Paz, saat 16:59 tarihinde Mohan Goud şunu yazdı: > > > students list is in database. I have to search based on section, > department and year and sort them in ascending order. can any one help me > on this through any video links or any other. > > -- > You received this

filtering and searching help - regarding

2019-02-03 Thread Mohan Goud
students list is in database. I have to search based on section, department and year and sort them in ascending order. can any one help me on this through any video links or any other. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscri

I'm getting nothiong on template after filtering there so i'm looking for a solution to filter in a model thorugh foreign key

2018-10-30 Thread Karan Talwar
*views.py* from django.shortcuts import render from .models import inherit # Create your views here. def homepage(request): ab = inherit.objects.filter(name__name__contains='karan') return render(request, 'jobs/index.html', {'x':ab} ) Models.py *from django.db import models* *# Create your mo

Re: Django Admin Filtering Drop Down Menu by Date

2018-10-15 Thread mab . mobile . 01
Hello Nelson, I may need you to walk me through this more. I am relatively new to Django. I modified my admin.py and added from django import forms and added the following code in the admin.py file. It's still giving me an error ... "type object 'EmployeeSchedule' has no attribute 'events'" I

Re: Django Admin Filtering Drop Down Menu by Date

2018-10-15 Thread mab . mobile . 01
Thank you Nelson. I will try this option. On Friday, October 12, 2018 at 9:57:31 AM UTC-5, Nelson Varela wrote: > > You could make a custom form for your admin which is a model form which >> points to EmployeeSchedule. And in the form its init you can change the >> queryset of the events field:

Re: Django Admin Filtering Drop Down Menu by Date

2018-10-12 Thread Nelson Varela
> > You could make a custom form for your admin which is a model form which > points to EmployeeSchedule. And in the form its init you can change the > queryset of the events field: > self.fields['events'].queryset = WineryEvents.objects.filter(publish='Y'). filter(event_date__gte=datetime.now(

Re: Django Admin Filtering Drop Down Menu by Date

2018-10-11 Thread Derek
Your question does not make sense (as written): "To add a new event I would like to pick from a drop down list of only the events that are in the future" .. Why should adding a new event depend on you selecting another event? Are the events related or dependant in some way; that is not clear?

Django Admin Filtering Drop Down Menu by Date

2018-10-09 Thread mab . mobile . 01
Hello, I am trying to develop an employee schedule based on upcoming events and I only need to make additions or updates in Django Admin. To add a new event I would like to pick from a drop down list of only the events that are in the future or on todays date not the entire table list of event

Re: Filtering Queryset by Foreign Key Properties

2018-03-31 Thread Daniel Sears
You may want to first write a test for this using something like pytest. That's what I did and the following worked fine. Note that query is a queryset, which is an iterable. So you have to index it. And product__type__name will ultimately match with a string because the name field in ProductType i

Re: Filtering Queryset by Foreign Key Properties

2018-03-31 Thread Jamaldin Pro
Can anyone help me? -- 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@

Filtering Queryset by Foreign Key Properties

2018-03-31 Thread Jamaldin Pro
> > class ProductType(models.Model): > > image = models.ImageField(upload_to='products_type_images/') > name = models.CharField(max_length=20, blank=True, null=True, > default=None) > is_active = models.BooleanField(default=True) > > def __str__(self): > return "%s" % self

Re: Filtering Queryset by Foreign Key Properties

2018-03-30 Thread Jamaldin Pro
> > class ProductType(models.Model): > class Meta: > verbose_name_plural = 'тип' > verbose_name = 'типы' > > image = models.ImageField(upload_to='products_type_images/') > name = models.CharField(max_length=20, blank=True, null=True, > default=None) > is_active = m

New release of django-ai: Spam Filtering systems

2018-01-15 Thread Matemática A3K
I’m very happy of announcing the second release of django-ai: Artificial Intelligence for Django. https://github.com/math-a3k/django-ai https://django-ai.readthedocs.io/en/latest/readme.html The main exciting features of this version are Spam Filtering systems and Classification with Support

Django rest framework filtering foreign key value and setting userId = current user

2018-01-03 Thread cherngyorng
So i have a family and schedule model. Family is to add family member and schedule is to create schedule with family as a foreign key in it. But in both api, userId field is a drop down field to select which a user instead of using fix at the current userId. The code and more specific about my

Re: Single-page app with dynamic filtering - 2 options to proceed

2017-12-18 Thread Matemática A3K
On Mon, Dec 18, 2017 at 5:36 PM, Jack wrote: > I am building a real estate listings map, which dynamically refreshes its > filter whenever the user moves the map. The page never refreshes when a > change is made. Think Zillow/Trulia >

Single-page app with dynamic filtering - 2 options to proceed

2017-12-18 Thread Jack
I am building a real estate listings map, which dynamically refreshes its filter whenever the user moves the map. The page never refreshes when a change is made. Think Zillow/Trulia

Filtering using viewsets in django rest framework

2017-03-03 Thread Benjamin Smith
ter(r'show-list', views.ShowViewSet) Now I would like to get all the TimeTable objects (i.e. date list) by filtering all the Show objects by a specific movie object. This code seems to be the working and getting the list like I want it m = Movie.objects.get(id=request_id) TimeTable.o

Re: Filtering a many2many relationship while aggregating?

2016-12-30 Thread Richard Brockie
Aha - I think this does it: revised_ordered_series = racereg_models.Series.objects \ .filter(racedays__published=True, year=this_year, published=True) \ .annotate(latest_raceday=Max('racedays__date')) \ .order_by('latest_raceday') On Friday, December 30, 2016 at 4:49:51 PM UTC-8, R

Filtering a many2many relationship while aggregating?

2016-12-30 Thread Richard Brockie
Hi, I have the following many2many relationship between 2 models: class RaceDay(models.Model): date = models.DateField() published = models.BooleanField(default=False) class Series(models.Model): published = models.BooleanField(default=False) year = models.PositiveSmallIntegerFie

Re: Filtering in ListView

2016-11-26 Thread Artem Bernatskyy
If anyone is interested how i accomplished this without django-filter http://pastebin.com/6NLuM3eQ -- 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

Re: Filtering in ListView

2016-11-25 Thread Artem Bernatskyy
Wow, tried it and it is working like a charm ! -- 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,

Re: Filtering in ListView

2016-11-25 Thread Sergiy Khohlov
return Car.objects.filter(Company_id=context['company'].id) def get_context_data(self, **kwargs): """ filtering cars assigned to company with last coord""" context = super(CompanyDetail, self).get_context_data(**kwargs)

Re: Filtering in ListView

2016-11-25 Thread jorrit787
If you're ok with using an external package you can check out django-filter <https://github.com/carltongibson/django-filter>, it makes filtering very easy. On Thursday, November 24, 2016 at 8:35:30 PM UTC+1, Artem Bernatskyy wrote: > > Hello, > > how can i accomplish fi

Filtering in ListView

2016-11-24 Thread Artem Bernatskyy
Hello, how can i accomplish filtering in ListView via GET ? Now i am trying it with ListView and FormMixin... To keep long story short: - we are visiting page and filling form (which are generating from forms.py) - than we are sending it via GET to the same page - and somehow we need to

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-20 Thread Shamaila Moazzam
I have seller as a foreign key in Product model.. >>>>> >>>>> *products/models.py* >>>>> >>>>> class Product(models.Model): >>>>> user = models.ForeignKey(settings.AUTH_USER_MODEL) >>>>> seller = models.Fore

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Asad Jibran Ahmed
le = models.CharField(max_length=120) >>>> description = models.TextField(blank=True, null=True) >>>> price = models.DecimalField(decimal_places=2, max_digits=20) >>>> >>>> >>>> >>>> >>>> >>>> On Tuesd

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Shamaila Moazzam
;> >>> >>> >>> On Tuesday, September 20, 2016 at 10:09:01 AM UTC+5, Asad Jibran Ahmed >>> wrote: >>>> >>>> Hi, >>>> While you didn't show us the Product model, I assume it has a >>>> ForeignKey to the Ord

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Asad Jibran Ahmed
>>> >>> Hi, >>> While you didn't show us the Product model, I assume it has a >>> ForeignKey to the Order model. To filter for Products that have an Order >>> with a sold status, you should look at the documentation for filtering on >>> rel

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Asad Jibran Ahmed
't show us the Product model, I assume it has a ForeignKey >> to the Order model. To filter for Products that have an Order with a >> sold status, you should look at the documentation for filtering on >> relationships at https://docs.djangoproject.com >> /en/1.10/topics/db/q

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Shamaila Moazzam
s a ForeignKey > to the Order model. To filter for Products that have an Order with a sold > status, you should look at the documentation for filtering on relationships > at > https://docs.djangoproject.com/en/1.10/topics/db/queries/#lookups-that-span-relationships > . >

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Asad Jibran Ahmed
Hi, While you didn't show us the Product model, I assume it has a ForeignKey to the Order model. To filter for Products that have an Order with a sold status, you should look at the documentation for filtering on relationships at https://docs.djangoproject.com/en/1.10/topics/db/qu

Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Shamaila Moazzam
hi I am a beginner in django/python * :(* I am making a dashboard of sellers App. I am stuck in filtering orders of the products according to the logged in user(seller) *sellers/models.py* from django.conf import settings from django.core.urlresolvers import reverse from django.db import

Re: Filtering models by user or by items

2016-09-02 Thread Shamaila Moazzam
Thanks@Mandeep...i will apply this also and let you know actually i have changed my models and have put seller as F.K in Product. after that def get_products(self): account = self.get_account() products = Product.objects.filter(seller=account) self.products = products return products. regards.

Re: Filtering models by user or by items

2016-09-02 Thread mandeep444
def get_shopproducts(self): account = self.get_shopaccount() ## this is the problem area.. here i want to filter like products = Product.objects.filter(*pk__in=[id for i.product in **account **]*) return products I hope this help you. On Thursday, September 1, 2016 at 9:15:45

Re: Filtering models by user or by items

2016-09-01 Thread Shamaila Moazzam
@ Mudassar .Thanx for your reply but this query is not working. On Thursday, September 1, 2016 at 8:58:53 PM UTC+5, M Hashmi wrote: > > What did you get with: > products = Product.objects.filter(account=user) > As it is inheriting user from get_shopaccount method. > > Regards, > Mudassar > > On T

Re: Filtering models by user or by items

2016-09-01 Thread M Hashmi
What did you get with: products = Product.objects.filter(account=user) As it is inheriting user from get_shopaccount method. Regards, Mudassar On Thu, Sep 1, 2016 at 8:45 AM, Shamaila Moazzam wrote: > am making a shops dashboard view .in that view i have used a mixin as > mentioned belowmy

Filtering models by user or by items

2016-09-01 Thread Shamaila Moazzam
am making a shops dashboard view .in that view i have used a mixin as mentioned belowmy issue is i want to get products related to a specific account or user . i have products m2m in shop model and also have user f.k in Shop model. In get_shopproducts() function in ShopAccountMixin()..i am unab

which regex are for filtering malicious input in django?

2016-06-09 Thread meInvent bbird
which regex are for filtering malicious input in django? -- 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.

Re: Reverse Foriegnkey filtering

2016-01-30 Thread Peter of the Norse
> On Jan 27, 2016, at 5:15 AM, Michal Petrucha > wrote: > > On Wed, Jan 27, 2016 at 11:58:23AM +, Jonty Needham wrote: >> I've found a need to do this and I'm struggling. Some info seems to >> indicate that django doesn't support this. How is it meant to be done? >> >> Basically to be clear

Re: Reverse Foriegnkey filtering

2016-01-27 Thread Michal Petrucha
On Wed, Jan 27, 2016 at 11:58:23AM +, Jonty Needham wrote: > I've found a need to do this and I'm struggling. Some info seems to > indicate that django doesn't support this. How is it meant to be done? > > Basically to be clear, I need to filter one queryset on a reverse > foriegnkey relation

Re: Reverse Foriegnkey filtering

2016-01-27 Thread Rafael E. Ferrero
why not filter model2 with select_related ?? (you already try to put a related_name in the foreignkey of model2?) cheers! Rafael E. Ferrero 2016-01-27 8:58 GMT-03:00 Jonty Needham : > I've found a need to do this and I'm struggling. Some info seems to > indicate that django doesn't support this

Reverse Foriegnkey filtering

2016-01-27 Thread Jonty Needham
I've found a need to do this and I'm struggling. Some info seems to indicate that django doesn't support this. How is it meant to be done? Basically to be clear, I need to filter one queryset on a reverse foriegnkey relation to another set of objects defined by a particualr filter. model1(Models.

Re: Additional Search/Filtering based on a Model's fields in horizontal_filter

2016-01-20 Thread Dheerendra Rathor
You can add your fields in search_fields in ModelAdmin to make them searchable. On Thu, 21 Jan 2016 at 03:35 Keehun Nam wrote: > Hi Django Users, > > Is there a preexisting solution where I can have an admin widget like > horizontal_filter except it has the ability to search by the model's field

Additional Search/Filtering based on a Model's fields in horizontal_filter

2016-01-20 Thread Keehun Nam
Hi Django Users, Is there a preexisting solution where I can have an admin widget like horizontal_filter except it has the ability to search by the model's fields (not just the string representation in a list? Say I have a PERSON model with fields: Name, Country, and Vehicle Type. Right now, w

Filtering records based on date months

2015-10-14 Thread 'Chris Norman' via Django users
Hi all, I have written a Journey model, which has an out and a back field, both of which are datetime fields. What I want to do is something like: from datetime import datetime now = datetime.now() for journey in Journey.objects.filter(out__month = now.month, out__day = now.day): print jour

Re: order_by did't work after filtering by foreign key

2015-07-25 Thread James Schneider
Do you have multiple posts from the same day that are showing up out of order, but posts across multiple days are at least grouped together by day? You are using a DateField rather than a DateTimeField, which may lead to unanticipated results when you have multiple entries on the same day. You nee

order_by did't work after filtering by foreign key

2015-07-25 Thread Nguyễn Minh Thế
I have a model like this class Category(models.Model): title = models.CharField(max_length=100, db_index=True) slug = models.SlugField(max_length=100, db_index=True) def __str__(self): return "%s"%self.title class Video(models.Model): title = models.CharField(max_length=

Re: Filtering a QuerySet by the result of user.has_perm

2015-03-12 Thread Collin Anderson
Hi Adam, It's pretty inefficient, but you can do: MyModel.objects.filter(pk__in=[obj.pk for obj in MyModel.objects.all() if user.has_perm('read', obj)]) But, actually, I think you want to use get_objects_for_user(): http://django-guardian.readthedocs.org/en/v1.2/userguide/check.html#get-objects-

Filtering a QuerySet by the result of user.has_perm

2015-03-10 Thread Adam Gamble
Hi all, I'm stuck on how to restructure the following in order to return a QuerySet instead of a List (needed for Lazy evaluation): filter(lambda o: user.has_perm('read', o), MyModel.objects.all()) Using django-guardian , for object-level permissions. A

  1   2   3   4   5   6   7   >