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

2021-06-17 Thread Nikeet NA
Its not the perfect method you can optimize ot more if you want. You can prefer this Link <https://docs.djangoproject.com/en/3.2/topics/db/managers/#custom-managers> On Thu, 17 Jun 2021 at 18:06, Nikeet NA wrote: > You can do it like this : > > class TransactionEntry

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

2021-06-17 Thread Nikeet NA
20170...@pilani.bits-pilani.ac.in> wrote: > what about overwriting the manager? How to make the manager auto-add those > computed properties ? > > On Thursday, June 17, 2021 at 8:50:27 AM UTC+5:30 Nikeet NA wrote: > >> You cannot use properties in django orm , it does no

Re: Need to volunteer in a django project to emprove my knowledge

2021-06-17 Thread Nikeet NA
OK that interesting I can help. On Thursday, 17 June 2021 at 17:03:28 UTC+5:30 flavie...@gmail.com wrote: > Actually im not working on any django project but i was working on > geodjango in the past > Flavien > > On 6/17/21, Nikeet NA wrote: > > What type of project

Re: Need to volunteer in a django project to emprove my knowledge

2021-06-17 Thread Nikeet NA
What type of project are you working upon ? On Thursday, 17 June 2021 at 16:51:01 UTC+5:30 flavie...@gmail.com wrote: > hi guys in term of improving my knowledge in building Django project, > i need to be a volunteer > I'm good in English and fluent in French > > My WhatsApp number:+243815357825

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

2021-06-16 Thread Nikeet NA
You cannot use properties in django orm , it does not 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, > > I wanted to know that how

Re: How to use django template tags in .js file ??

2021-06-16 Thread Nikeet NA
Or you can store the url in the variable then use it. On Thursday, 17 June 2021 at 00:29:00 UTC+5:30 Nikeet NA wrote: > Do like this use > var obj_slug = object.slug inside script tag below it include your js file > with the above js script. in js file you can acces it with

Re: CUSTOM AUTH WITH CELERY WORKER FOR SENDING EMAIL

2021-06-16 Thread Nikeet NA
Can you describe in detail , sending mails is possible through celery but i am un clear about auth part. On Wednesday, 16 June 2021 at 22:31:41 UTC+5:30 kuassi...@paydunya.com wrote: > Hello Community. I would like to have recommendations on how to implement > a custom authentication with the

Re: How to use django template tags in .js file ??

2021-06-16 Thread Nikeet NA
Do like this use var obj_slug = object.slug inside script tag below it include your js file with the above js script. in js file you can acces it with obj_slug variable. On Wednesday, 16 June 2021 at 22:31:39 UTC+5:30 kuassi...@paydunya.com wrote: > I also had the problem once. But what I

Re: Desperately need help.

2021-06-15 Thread Nikeet NA
In your withdraw view you have return render this should be missing check inside if statements or inside your custom logic which you have written without seeing the actual code its hard to tell. On Wednesday, 16 June 2021 at 03:14:26 UTC+5:30 Ken Smith wrote: > jul, thank you so very much for

Re: File in nested serializer

2021-06-15 Thread Nikeet NA
son.dumps() it will accept the child one > but problem here is json.dumps() cannot convert InMEmoryField data type. So > what will be the best way to do it. If you have some idea please share with > me > > > On Tue, Jun 15, 2021 at 2:49 PM Nikeet NA wrote: > >> Use

Re: Find number of days between two date excluding weekend days and display the number in text field

2021-06-15 Thread Nikeet NA
eugenet...@gmail.com wrote: > Dear NA, > > I accomplished this with numpy. How can I get the value (difference > between the two dates) when I select the second date for example in the > text field? I know Javascript can be used but how? > > On Tue, 15 Jun 2021 at 11

Re: Find number of days between two date excluding weekend days and display the number in text field

2021-06-15 Thread Nikeet NA
You need to loop through the dates maintain a count variable get the weekday for every datetime object with date.weekday() exclude as per your need for days you dont want to count. On Tuesday, 15 June 2021 at 11:30:21 UTC+5:30 eugenet...@gmail.com wrote: > Team, > > I have date1 and date2

Re: Django Query vs SQL query

2021-06-15 Thread Nikeet NA
use the related name on the staff model for project field with __ lookup as in class Staff(models.Model): . . project = foreignkey relationship (related_name='staffs') SO the query would be Projects.objects.filter(staffs__project_id=F('pk')) On Tuesday, 15 June 2021 at

Re: location based web app with django and geodjango

2021-06-15 Thread Nikeet NA
Your app is not registered in settings file as stated by Aritra. On Tuesday, 15 June 2021 at 14:22:45 UTC+5:30 arit...@gmail.com wrote: > Hello, > Register your app in setting.py-> INSTALLED_APPS like > 'appname.apps.appnameConfig' from your apps.py. Alternatively, you can > write 'app_name'

Re: File in nested serializer

2021-06-15 Thread Nikeet NA
Use This Drf nested serializer On Tuesday, 15 June 2021 at 10:48:22 UTC+5:30 narendra...@gmail.com wrote: > Hi Folks, > I'm having a problem to insert a data in nested serializers with > FileField. If anybody know the idea of doing that would

Re: Github - ( Image formation Issue )

2021-06-15 Thread Nikeet NA
Jun 15, 2021, 10:13 Sakshi jain wrote: > >> both ...in project folder I make one new folder and add all image's >> >> On Tue, Jun 15, 2021, 10:11 Nikeet NA wrote: >> >>> The image is it in your project root folder inside static ?? >>> >>> On Tues

Re: Github - ( Image formation Issue )

2021-06-14 Thread Nikeet NA
directory > warning: LF will be replaced by CRLF in AppData/Local/Google/Chrome/User > Data/Crowd Deny/2021.6.7.1141/manifest.json. > The file will have its original line endings in your working directory > error: open("AppData/Local/Google/Chrome/User Data/Default/Cache/data_0&q

Re: location based web app with django and geodjango

2021-06-14 Thread Nikeet NA
Replace admin.site.register(Report) with this @admin.register(Report) On Tuesday, 15 June 2021 at 05:46:46 UTC+5:30 staka...@gmail.com wrote: > good evening all, > > I have started building a webapp using python, django and linux, but i'm > afraid the app does not appear under admin tab in

Re: In need of help regarding HTML Submit button

2021-06-14 Thread Nikeet NA
Change the type of button back to type='button" rather than type="submit" On Monday, 14 June 2021 at 22:39:27 UTC+5:30 arit...@gmail.com wrote: > Hi, > I'm facing an error with the Place Order button not working when the user > is choosing the default address. Kindly help me out in this regard

Re: Github - ( Image formation Issue )

2021-06-14 Thread Nikeet NA
Move those images to static folder then add then with static tag. Do upload the static folder to on your server. On Monday, 14 June 2021 at 21:45:00 UTC+5:30 vn241...@gmail.com wrote: > Hello team, > I'm Er. Sakshi jain > > I'm trying to design simple E-commerce website without using any

Re: CHOICES

2021-06-13 Thread Nikeet NA
from django.db.models import Sum, DecimalField from django.db.models.functions import Cast Model.objects.annotate(deci_con_factor=Cast('conversion_factor', DecimalField()).aggregate(sum=Sum('deci_con_factor')).get('sum') You need to change your char type to decimal type , you can use CAST

Re: Make permissions according branch id

2021-06-13 Thread Nikeet NA
What you are trying to do is called object-level permission in Django, normally people use is model-level permission, you can use this module Django guardian . On Sunday, 13 June 2021 at 10:33:06 UTC+5:30 waelmuh...@gmail.com wrote: > Did any

Re: User matching query does not exist.

2021-06-12 Thread Nikeet NA
There is no user with id 1. Wrap this statement inside try catch block : user = User.objects.get(id=uid) and catch the DoesNotExist exception as except User.DoesNotExist: On Saturday, 12 June 2021 at 18:13:09 UTC+5:30 shilpa...@gmail.com wrote: > Environment: > > > Request Method: GET >

Re: Allow field validation in ajax.

2021-06-12 Thread Nikeet NA
You are not submitting your form which Inturn is not validating. For validations to run you need to submit a form. Give the submit button attribute type="submit", then add an event listener for form submit in your javascript. $("#ReportForm").on('submit', function(event) { // here event

Re: IndexError at /

2021-06-12 Thread Nikeet NA
Your list is empty check for it then return count as 0 if the list is not empty then return qs[0].items.count() On Sat, 12 Jun 2021 at 02:55, Jacob Greene wrote: > The backtrace is pretty clear.. > > Here's the import part: > File "C:\Users\GEMINI INNOVATIONS\Documents\WEB DEV TUTOR FULL >

Re: django cron Job Functionality

2021-06-11 Thread Nikeet NA
You should use celery for running cron jobs. On Friday, 11 June 2021 at 19:49:41 UTC+5:30 kells...@gmail.com wrote: > > What I would do in such case, is to write a function somewhere that checks > if a user applied for a leave, then check if the leave time is within a > day, then do whatever

Re: [DRF] Serializing a field of type choice

2021-06-10 Thread Nikeet NA
You must me getting the keys of your choices rather than your choice text , you can override the field with serializer method field and return your text according to your choice key. On Thu, 10 Jun 2021 at 09:57, Lalit Suthar wrote: > can I see that model field, I don't think any extra