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 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("num_shares")*F("price_per_share"))`
>
> but that is undesirable. I just want to use that function on the model and 
> not hard code the formula.
> Thanks,
>
>
>
> class TransactionEntry(models.Model):
> """Model to save data of users who want to buy/sell shares"""
>
> user = models.ForeignKey(
> to=Relative,
> on_delete=models.CASCADE,
> related_name="transaction_entry",
> )
>
> num_shares = models.PositiveIntegerField(null=False, blank=False)
> date_of_trade = models.DateField(null=False, blank=False)
> transaction_type = models.CharField(
> max_length=1,
> choices=TransactionType.choices,
> default=TransactionType.SELL,
> null=False,
> )
> price_per_share = models.FloatField(null=False, blank=False)
>
> def get_total_price(self):
> return self.num_shares * self.price_per_share
>
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/d4270b04-4fee-4c95-8da0-d525f1a4999cn%40googlegroups.com.


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("num_shares")*F("price_per_share"))`

but that is undesirable. I just want to use that function on the model and 
not hard code the formula.
Thanks,



class TransactionEntry(models.Model):
"""Model to save data of users who want to buy/sell shares"""

user = models.ForeignKey(
to=Relative,
on_delete=models.CASCADE,
related_name="transaction_entry",
)

num_shares = models.PositiveIntegerField(null=False, blank=False)
date_of_trade = models.DateField(null=False, blank=False)
transaction_type = models.CharField(
max_length=1,
choices=TransactionType.choices,
default=TransactionType.SELL,
null=False,
)
price_per_share = models.FloatField(null=False, blank=False)

def get_total_price(self):
return self.num_shares * self.price_per_share

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/20b0067b-cbfc-49c5-90ef-c302504cac7bn%40googlegroups.com.


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 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 understood is that the 
>> interpretation of the DJANGO syntax in statics files only works when the 
>> file has an HTML extension. So if you really want to do something separate 
>> with the script you can just create another HTML file but in another folder 
>> where you will put the script content surrounded by the SCRIPT tags and 
>> then you will just include with the directive {% INCLUDE %} in 
>> your main HTML file.
>>
>> On Wednesday, June 16, 2021 at 3:59:16 PM UTC bisht.a...@gmail.com wrote:
>>
>>> while doing great stuff with django I have found some clumsy behaviour 
>>> of django in handling .js file. Is there a way to effectively integrate all 
>>> the stuff of   in a separate file and effectively used it 
>>> with rest of the html code. 
>>>
>>> for example : 
>>>
>>> // *file.html 
>>> ..*
>>>
>>> 
>>>   
>>>
>>> >> method="POST" id="likes-form">
>>> {% csrf_token %}
>>>
>>> >> id="like-{{
>>> object.pk}}">
>>> 
>>>   
>>>   
>>> {{ object.total_likes }}
>>>   
>>> 
>>>
>>>
>>>
>>>
>>> //  *file.js file*  
>>> ..
>>>
>>> $("#likes-form").submit(function (e)
>>> {  e.preventDefault();
>>>   var serializedData = $(this).serializeArray();
>>>   $.ajax({
>>>   type: 'POST',
>>>   url: '{% url 'blog_likes' object.slug  %}',
>>>   data: serializedData,
>>>   success: function (response) {
>>> var like_count = JSON.parse(response["like"]);
>>> like_flag = JSON.parse(response["flag"]);
>>> 
>>> console.log(like_flag);
>>>   
>>> if(like_flag == 0){  
>>> $(".like-inner-flex-1").toggleClass('like-animate');   
>>>   }else
>>>   $(".like-inner-flex-1").toggleClass('like-animate'); 
>>>   
>>>   if(like_flag){
>>>
>>>   $('.like-btn').css({"background-color": "#d629801a" , "outline": 
>>> "none"});
>>>
>>> $('.like-inner-flex-1').css({"background-position": "right",  
>>> "filter": "grayscale(0%)"});
>>>
>>> } else {
>>>
>>> $('.like-btn').css({"background-color": "transparent", "outline": 
>>> "none"});
>>>
>>> $('.like-inner-flex-1').css({"background-position": "right",  
>>> "filter": "grayscale(100%)"});
>>>
>>> }
>>>
>>> $("#likes").text(`${like_count}`);
>>> }})
>>> })
>>>
>>> ..
>>>
>>> if I use above script inside the same html file then it works, but in 
>>> above case its not working ?? If there is any work around to do this thing 
>>> , then please suggest me .
>>>
>>> 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 emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3e005ecb-77c9-4fac-aa10-ba0d7059c758n%40googlegroups.com.


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 use of CELERY for sending mails which will 
> be QUEUE and managed by a workers that I will start on my server with the 
> BROKER REDIS.
>
> Please if anyone have suggestions for me or any articles for that i'm glad 
> to receive them.
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/e5961172-716a-4a6b-a21f-54502a20a045n%40googlegroups.com.


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 understood is that the 
> interpretation of the DJANGO syntax in statics files only works when the 
> file has an HTML extension. So if you really want to do something separate 
> with the script you can just create another HTML file but in another folder 
> where you will put the script content surrounded by the SCRIPT tags and 
> then you will just include with the directive {% INCLUDE %} in 
> your main HTML file.
>
> On Wednesday, June 16, 2021 at 3:59:16 PM UTC bisht.a...@gmail.com wrote:
>
>> while doing great stuff with django I have found some clumsy behaviour of 
>> django in handling .js file. Is there a way to effectively integrate all 
>> the stuff of   in a separate file and effectively used it 
>> with rest of the html code. 
>>
>> for example : 
>>
>> // *file.html 
>> ..*
>>
>> 
>>   
>>
>> > method="POST" id="likes-form">
>> {% csrf_token %}
>>
>> > id="like-{{
>> object.pk}}">
>> 
>>   
>>   
>> {{ object.total_likes }}
>>   
>> 
>>
>>
>>
>>
>> //  *file.js file*  
>> ..
>>
>> $("#likes-form").submit(function (e)
>> {  e.preventDefault();
>>   var serializedData = $(this).serializeArray();
>>   $.ajax({
>>   type: 'POST',
>>   url: '{% url 'blog_likes' object.slug  %}',
>>   data: serializedData,
>>   success: function (response) {
>> var like_count = JSON.parse(response["like"]);
>> like_flag = JSON.parse(response["flag"]);
>> 
>> console.log(like_flag);
>>   
>> if(like_flag == 0){  
>> $(".like-inner-flex-1").toggleClass('like-animate');   
>>   }else
>>   $(".like-inner-flex-1").toggleClass('like-animate'); 
>>   
>>   if(like_flag){
>>
>>   $('.like-btn').css({"background-color": "#d629801a" , "outline": 
>> "none"});
>>
>> $('.like-inner-flex-1').css({"background-position": "right",  
>> "filter": "grayscale(0%)"});
>>
>> } else {
>>
>> $('.like-btn').css({"background-color": "transparent", "outline": 
>> "none"});
>>
>> $('.like-inner-flex-1').css({"background-position": "right",  
>> "filter": "grayscale(100%)"});
>>
>> }
>>
>> $("#likes").text(`${like_count}`);
>> }})
>> })
>>
>> ..
>>
>> if I use above script inside the same html file then it works, but in 
>> above case its not working ?? If there is any work around to do this thing 
>> , then please suggest me .
>>
>> 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 emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5646832c-ab1a-4e58-8e10-0b178ddab1c0n%40googlegroups.com.


Re: Local host not opening

2021-06-16 Thread Krish M
Depending on your setup, if your database is pointing to 
production(Heroku) then the local migrate would be make changes to the  
Heroku database.
If not, you would need to follow best practice below:

Django Migrations - Heroku Help 


On Wednesday, June 16, 2021 at 1:59:32 PM UTC-4 rhythm...@gmail.com wrote:

> Hey Thanks for your reply.
> I forgot to add the database url in the settings.py file. I added that and 
> it worked.
>
> But I've got a doubt, now I would be working on local host and if I update 
> the models and execute the 
> "python manage.py  migrate" command, would the changes be reflected in the 
> database and heroku app or do I need to run the command "heroku . 
> python manage.py migrate"  ?
>
>
>
> On Wed, Jun 16, 2021, 11:21 PM Krish M  wrote:
>
>> Rhythm,
>>
>> The settings must be in uppercase - try changing it to 'PASSWORD'
>>
>> Without seeing your setting.py (without your credential of course) there 
>> is no way to debug.
>>
>>
>>
>>
>> On Wednesday, June 16, 2021 at 1:01:52 PM UTC-4 rhythm...@gmail.com 
>> wrote:
>>
>>> I created a django website and deployed it on heroku and have used aws 
>>> s3 and amazon RDS Postgres database.
>>> Now when i try to run python manage.py runserver in my cmd it gives 
>>> error - 
>>> psycopg2.OperationalError: fe_sendauth: no password supplied
>>> I have set os.environ.get to name, user, password and host variables in 
>>> the database section in settings.py.
>>> What should i do to resolve this? Please someone help.
>>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/a98496c5-e2a5-493d-b7a7-e8a05f51838an%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/66af5d1d-20c5-4e15-836b-60bd73ac1542n%40googlegroups.com.


Re: Adding Two Models In Django

2021-06-16 Thread Ridwan Adeyemo
Thanks man.👍

On Wed, Jun 16, 2021, 5:22 PM Ayush Bisht  wrote:

> I think you are trying to sum up the value of two model fields and store
> them in some other field.
>
>
> so for that u can proceed from base.
>
> simple you just have to update that field in save method
>
> for example :
>  *class Student(models.Model):*
>maths_score = models.DecimalField()
>english_score = models.DecimalFIeld()
>Total_score   = models.DecimalField(default = 0)
>
>*def save(self, *args, **kwargs):*
> *  self.Total_score  = self.maths_score  + self.english_score*
>   super(Student, self).save(*args, **kwargs)
>
>
>
> or you can proceed with clean() method also.
> On Tuesday, June 15, 2021 at 11:34:37 AM UTC-7 adesolar...@gmail.com
> wrote:
>
>> How do I add two models together in the database, two different
>> DecimalField.
>> i.e math_score + eng_score = total_score
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/qsaj_ELIfgA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/81d7b7b1-9521-47b1-9fef-91be3ba4c952n%40googlegroups.com
> 
> .
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/CABGdKQw3004v-NOK1hC56WrrpjmnXJ_fSL1BAN0kNXcJq5dMPw%40mail.gmail.com.


Re: Local host not opening

2021-06-16 Thread Rhythm Batra
Hey Thanks for your reply.
I forgot to add the database url in the settings.py file. I added that and
it worked.

But I've got a doubt, now I would be working on local host and if I update
the models and execute the
"python manage.py  migrate" command, would the changes be reflected in the
database and heroku app or do I need to run the command "heroku .
python manage.py migrate"  ?



On Wed, Jun 16, 2021, 11:21 PM Krish M  wrote:

> Rhythm,
>
> The settings must be in uppercase - try changing it to 'PASSWORD'
>
> Without seeing your setting.py (without your credential of course) there
> is no way to debug.
>
>
>
>
> On Wednesday, June 16, 2021 at 1:01:52 PM UTC-4 rhythm...@gmail.com wrote:
>
>> I created a django website and deployed it on heroku and have used aws s3
>> and amazon RDS Postgres database.
>> Now when i try to run python manage.py runserver in my cmd it gives error
>> -
>> psycopg2.OperationalError: fe_sendauth: no password supplied
>> I have set os.environ.get to name, user, password and host variables in
>> the database section in settings.py.
>> What should i do to resolve this? Please someone help.
>>
> --
> 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 on the web visit
> https://groups.google.com/d/msgid/django-users/a98496c5-e2a5-493d-b7a7-e8a05f51838an%40googlegroups.com
> 
> .
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/CAOREs_edtsAaWh6a9tnbA0AmeS4rPkNqtFch1h9Ma4gdk4mTHg%40mail.gmail.com.


Re: Mobile session issue

2021-06-16 Thread Krish M
Which one are you using?

Browser-length-sessions or  persistent-sessions?

On Tuesday, June 15, 2021 at 6:50:50 PM UTC-4 bhoop...@gmail.com wrote:

> Hi team,
>
> When I am logining from laptop browser then session storing all keys and 
> respective vales but when I am trying to login from mobile then keys and 
> values are not present in the session.
> But session is available in both case.
> Please help me on this.
>
> Thanks
> Bhoopesh sisoudiya
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/30ea84ad-7417-45e4-881b-001d9b8c7f29n%40googlegroups.com.


Re: Local host not opening

2021-06-16 Thread Krish M
Rhythm,

The settings must be in uppercase - try changing it to 'PASSWORD'

Without seeing your setting.py (without your credential of course) there is 
no way to debug.




On Wednesday, June 16, 2021 at 1:01:52 PM UTC-4 rhythm...@gmail.com wrote:

> I created a django website and deployed it on heroku and have used aws s3 
> and amazon RDS Postgres database.
> Now when i try to run python manage.py runserver in my cmd it gives error 
> - 
> psycopg2.OperationalError: fe_sendauth: no password supplied
> I have set os.environ.get to name, user, password and host variables in 
> the database section in settings.py.
> What should i do to resolve this? Please someone help.
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/a98496c5-e2a5-493d-b7a7-e8a05f51838an%40googlegroups.com.


Re: Desperately need help.

2021-06-16 Thread Ken Smith
Thank you very much they are very much aware that there is a problem with
that page and and they seemed not be able to fix it for a week's now. I
have contacted them time and time again about it. Actually I am beginning
to think that they have at that way on purpose of that they don't have to
pay out  Is there customers money they just keep getting it in. I take
rather that they might be very unscrupulous. Thank you for your input have
a great day

On Wed, Jun 16, 2021, 1:02 PM Krish M  wrote:

> Ken,
>
> Base on what you're asking, and from the source code (view-source) &
> screenshot, I don't think you have access to the right code to make the fix.
>
> Maybe contacting safewayfx.com and letting them know their platform has a
> bug?
>
> If they are unwilling to fix their backend bug, then there is nothing us
> here can help with.
>
> I am assuming, if you have access to the backend code (Python, Django) you
> should hire someone to fix that bug for you, you can point them to Jul
> response.
>
> On Tuesday, June 15, 2021 at 10:45:05 PM UTC-4 Nikeet NA wrote:
>
>>
>> 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 your very simple and honest answer. This
>>> was the best response I could have ever received from anyone and I
>>> appreciate it. I'm getting a bit old at 66 it seems my brain doesn't work
>>> as good as it did even 10 years ago for learning something as difficult as
>>> coding. Although your suggestion makes good sense and holds merit. I do
>>> thank you for your response. I only ask one more simple thing can you tell
>>> me which line of the code the HTTP response is missing from.
>>>
>>> Your answer has really opened up my brain to the possibility that the
>>> website has left that out on purpose so that members cannot withdraw their
>>> money.
>>>
>>> Again thank you so very much for your response and have a wonderful day
>>> On Tuesday, June 15, 2021 at 5:39:54 PM UTC-4 jul.ale...@gmail.com
>>> wrote:
>>>
 Pretty easy to be honest. The web page need an http response and it's
 give none instead. :)


 If you don't know about the code, maybe you should hire a developer or
 learn by yourself.

 El mar., 15 de junio de 2021 3:14 p. m., Ken Smith 
 escribió:

> There is the issue to solve that is the result of pressing the button
> to complete your transaction. And it may be dumb because I don't know a
> damn thing about  django and I assume that I would get an intelligent
> response on this forum.  This was in fact a sincere request because I know
> nothing about this code. If I did I would've discovered it myself. I 
> merely
> had the stupid assumption that someone would actually consider this a
> challenge. But apparently not even your up to a challenge maybe it's too
> hard for you. That is coded in django as I understand I may be wrong. I
> only read what was presented on the error page. If it's not that would you
> please direct me to what code it could possibly be as I am not a coder in
> any way shape or form. I stopped even trying long before these new methods
> of coding came out. I think the last time I tried to write code was in the
> 1990s. I know there is a solution to my question I just hope there is
> someone with the intelligence to take on the challenge for me or at least
> direct me to where I need to go instead of making jokes. Perhaps someone
> can tell me something about where I need to go or what I need to do there
> is a lot of money involved in getting this code correct so that I can send
> the corrected information to the company who owns the webpage. Not
> everybody here knows how to code some of us are actually wanting some
> answers to questions that we have. I am by trade an aircraft mechanic. So 
> I
> can laugh at you if I asked you to go clean the air sock and you don't 
> even
> know what I'm talking about but I won't because you don't know what I'm
> talking about. Neither do I know anything about what I presented and I
> don't pretend to know that's why I asked for some intelligent information.
> Have a good day regards Ken
> On Monday, June 14, 2021 at 5:21:42 PM UTC-4 jacobgr...@gmail.com
> wrote:
>
>> Lol what do you expect anyone to do? You just post some random HTML,
>> zero code, no backtrace, nothing to even indicate there is an issue that
>> someone could solve even IF they were willing... This has nothing to do
>> with Django. I don't understand what you thought was going to happen. 
>> This
>> is possibly the dumbest "question" I have ever read. I'd be willing to
>> consult at double my normal hourly rat

Local host not opening

2021-06-16 Thread Rhythm Batra
I created a django website and deployed it on heroku and have used aws s3
and amazon RDS Postgres database.
Now when i try to run python manage.py runserver in my cmd it gives error -
psycopg2.OperationalError: fe_sendauth: no password supplied
I have set os.environ.get to name, user, password and host variables in the
database section in settings.py.
What should i do to resolve this? Please someone help.

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/CAOREs_ePncPZrP3CzV6k9ZZfS3EOuury-zPy-aqy%3DAC-%3DCWBXg%40mail.gmail.com.


Re: Desperately need help.

2021-06-16 Thread Krish M
Ken,

Base on what you're asking, and from the source code (view-source) & 
screenshot, I don't think you have access to the right code to make the fix.

Maybe contacting safewayfx.com and letting them know their platform has a 
bug? 

If they are unwilling to fix their backend bug, then there is nothing us 
here can help with.

I am assuming, if you have access to the backend code (Python, Django) you 
should hire someone to fix that bug for you, you can point them to Jul 
response.

On Tuesday, June 15, 2021 at 10:45:05 PM UTC-4 Nikeet NA wrote:

>
> 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 your very simple and honest answer. This 
>> was the best response I could have ever received from anyone and I 
>> appreciate it. I'm getting a bit old at 66 it seems my brain doesn't work 
>> as good as it did even 10 years ago for learning something as difficult as 
>> coding. Although your suggestion makes good sense and holds merit. I do 
>> thank you for your response. I only ask one more simple thing can you tell 
>> me which line of the code the HTTP response is missing from.
>>
>> Your answer has really opened up my brain to the possibility that the 
>> website has left that out on purpose so that members cannot withdraw their 
>> money.
>>
>> Again thank you so very much for your response and have a wonderful day
>> On Tuesday, June 15, 2021 at 5:39:54 PM UTC-4 jul.ale...@gmail.com wrote:
>>
>>> Pretty easy to be honest. The web page need an http response and it's 
>>> give none instead. :) 
>>>
>>>
>>> If you don't know about the code, maybe you should hire a developer or 
>>> learn by yourself. 
>>>
>>> El mar., 15 de junio de 2021 3:14 p. m., Ken Smith  
>>> escribió:
>>>
 There is the issue to solve that is the result of pressing the button 
 to complete your transaction. And it may be dumb because I don't know a 
 damn thing about  django and I assume that I would get an intelligent 
 response on this forum.  This was in fact a sincere request because I know 
 nothing about this code. If I did I would've discovered it myself. I 
 merely 
 had the stupid assumption that someone would actually consider this a 
 challenge. But apparently not even your up to a challenge maybe it's too 
 hard for you. That is coded in django as I understand I may be wrong. I 
 only read what was presented on the error page. If it's not that would you 
 please direct me to what code it could possibly be as I am not a coder in 
 any way shape or form. I stopped even trying long before these new methods 
 of coding came out. I think the last time I tried to write code was in the 
 1990s. I know there is a solution to my question I just hope there is 
 someone with the intelligence to take on the challenge for me or at least 
 direct me to where I need to go instead of making jokes. Perhaps someone 
 can tell me something about where I need to go or what I need to do there 
 is a lot of money involved in getting this code correct so that I can send 
 the corrected information to the company who owns the webpage. Not 
 everybody here knows how to code some of us are actually wanting some 
 answers to questions that we have. I am by trade an aircraft mechanic. So 
 I 
 can laugh at you if I asked you to go clean the air sock and you don't 
 even 
 know what I'm talking about but I won't because you don't know what I'm 
 talking about. Neither do I know anything about what I presented and I 
 don't pretend to know that's why I asked for some intelligent information. 
 Have a good day regards Ken
 On Monday, June 14, 2021 at 5:21:42 PM UTC-4 jacobgr...@gmail.com 
 wrote:

> Lol what do you expect anyone to do? You just post some random HTML, 
> zero code, no backtrace, nothing to even indicate there is an issue that 
> someone could solve even IF they were willing... This has nothing to do 
> with Django. I don't understand what you thought was going to happen. 
> This 
> is possibly the dumbest "question" I have ever read. I'd be willing to 
> consult at double my normal hourly rate if you are the point of contact. 
>
> On Mon, Jun 14, 2021 at 12:12 PM Kasper Laudrup  
> wrote:
>
>> On 14/06/2021 05.15, Ken Smith wrote:
>> > I sure hope that somebody can take the time to do this. I'm just
>> > wondering one of you brilliant programmers can look at this webpage 
>> and
>> > tell me where the errors are so that it can be fixed? Apparently the
>> > programmers at the website are not as smart as you people are. If
>> > someone has the time and inclination to do so with a please go o

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

2021-06-16 Thread Kuassi Israel
I also had the problem once. But what I understood is that the 
interpretation of the DJANGO syntax in statics files only works when the 
file has an HTML extension. So if you really want to do something separate 
with the script you can just create another HTML file but in another folder 
where you will put the script content surrounded by the SCRIPT tags and 
then you will just include with the directive {% INCLUDE %} in 
your main HTML file.

On Wednesday, June 16, 2021 at 3:59:16 PM UTC bisht.a...@gmail.com wrote:

> while doing great stuff with django I have found some clumsy behaviour of 
> django in handling .js file. Is there a way to effectively integrate all 
> the stuff of   in a separate file and effectively used it 
> with rest of the html code. 
>
> for example : 
>
> // *file.html 
> ..*
>
> 
>   
>
>  method="POST" id="likes-form">
> {% csrf_token %}
>
>  id="like-{{
> object.pk}}">
> 
>   
>   
> {{ object.total_likes }}
>   
> 
>
>
>
>
> //  *file.js file*  
> ..
>
> $("#likes-form").submit(function (e)
> {  e.preventDefault();
>   var serializedData = $(this).serializeArray();
>   $.ajax({
>   type: 'POST',
>   url: '{% url 'blog_likes' object.slug  %}',
>   data: serializedData,
>   success: function (response) {
> var like_count = JSON.parse(response["like"]);
> like_flag = JSON.parse(response["flag"]);
> 
> console.log(like_flag);
>   
> if(like_flag == 0){  
> $(".like-inner-flex-1").toggleClass('like-animate');   
>   }else
>   $(".like-inner-flex-1").toggleClass('like-animate'); 
>   
>   if(like_flag){
>
>   $('.like-btn').css({"background-color": "#d629801a" , "outline": 
> "none"});
>
> $('.like-inner-flex-1').css({"background-position": "right",  
> "filter": "grayscale(0%)"});
>
> } else {
>
> $('.like-btn').css({"background-color": "transparent", "outline": 
> "none"});
>
> $('.like-inner-flex-1').css({"background-position": "right",  
> "filter": "grayscale(100%)"});
>
> }
>
> $("#likes").text(`${like_count}`);
> }})
> })
>
> ..
>
> if I use above script inside the same html file then it works, but in 
> above case its not working ?? If there is any work around to do this thing 
> , then please suggest me .
>
> 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 emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c39ae23c-28f6-4e38-9dec-87e6d4809759n%40googlegroups.com.


CUSTOM AUTH WITH CELERY WORKER FOR SENDING EMAIL

2021-06-16 Thread Kuassi Israel
Hello Community. I would like to have recommendations on how to implement a 
custom authentication with the use of CELERY for sending mails which will 
be QUEUE and managed by a workers that I will start on my server with the 
BROKER REDIS.

Please if anyone have suggestions for me or any articles for that i'm glad 
to receive them.

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/9b1e3a75-a347-417b-aa78-e346aac10ce9n%40googlegroups.com.


Re: Adding Two Models In Django

2021-06-16 Thread Ayush Bisht
I think you are trying to sum up the value of two model fields and store 
them in some other field. 


so for that u can proceed from base. 

simple you just have to update that field in save method

for example : 
 *class Student(models.Model):*
   maths_score = models.DecimalField()
   english_score = models.DecimalFIeld()
   Total_score   = models.DecimalField(default = 0)

   *def save(self, *args, **kwargs):*
*  self.Total_score  = self.maths_score  + self.english_score*
  super(Student, self).save(*args, **kwargs)



or you can proceed with clean() method also. 
On Tuesday, June 15, 2021 at 11:34:37 AM UTC-7 adesolar...@gmail.com wrote:

> How do I add two models together in the database, two different 
> DecimalField. 
> i.e math_score + eng_score = total_score
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-users/81d7b7b1-9521-47b1-9fef-91be3ba4c952n%40googlegroups.com.


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

2021-06-16 Thread Ayush Bisht
while doing great stuff with django I have found some clumsy behaviour of 
django in handling .js file. Is there a way to effectively integrate all 
the stuff of   in a separate file and effectively used it 
with rest of the html code. 

for example : 

// *file.html 
..*


  

{% csrf_token %}


  
  
{{ object.total_likes }}
  





//  *file.js file*  
..

$("#likes-form").submit(function (e)
{  e.preventDefault();
  var serializedData = $(this).serializeArray();
  $.ajax({
  type: 'POST',
  url: '{% url 'blog_likes' object.slug  %}',
  data: serializedData,
  success: function (response) {
var like_count = JSON.parse(response["like"]);
like_flag = JSON.parse(response["flag"]);

console.log(like_flag);
  
if(like_flag == 0){  
$(".like-inner-flex-1").toggleClass('like-animate');   
  }else
  $(".like-inner-flex-1").toggleClass('like-animate'); 
  
  if(like_flag){
  $('.like-btn').css({"background-color": "#d629801a" , "outline": 
"none"});
$('.like-inner-flex-1').css({"background-position": "right",  "filter": 
"grayscale(0%)"});

} else {
$('.like-btn').css({"background-color": "transparent", "outline": 
"none"});
$('.like-inner-flex-1').css({"background-position": "right",  "filter": 
"grayscale(100%)"});

}

$("#likes").text(`${like_count}`);
}})
})

..

if I use above script inside the same html file then it works, but in above 
case its not working ?? If there is any work around to do this thing , then 
please suggest me .

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 emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fbb6ae3c-2632-4183-9336-fb6bad5dfe0en%40googlegroups.com.