Not sure if I am doing django-paypal correctly

2021-12-29 Thread lone...@gmail.com
Hello all,

  I decided to try and accept payments on my web application.  I have 
chosen the django-paypal application to help me out with this task.  I 
found a decent walkthrough at: 
how-to-accept-paypal-payments-on-your-django-application 
.
  
I was able to follow everything until the last step of: "6. Setup a 
listener to detect successful Paypal payments"  I have never really setup 
any listeners before so I did not know what to do.  I decided to read the 
Django-PayPal 
ReadTheDocs 
 and I 
found a file that looked structurally similar to what I found on the 
original walkthrough I had found.  It looks like I needed to make a 
hooks.py file in my project directory.  I have accomplished that, and the 
ReadTheDocs says: "Remember to ensure that import the hooks file is 
imported i.e. that you are connecting the signals when your project 
initializes. The standard way to do this is to create an AppConfig class 

 and 
add a ready() 

 method, 
in which you can register your signal handlers or import a module that does 
this."  This is where I am getting lost.  I am not quite sure what to do.  
Does anyone have a better walkthrough or know what I need to do?

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/d9567663-20fb-4f43-a6c5-131f23497a7bn%40googlegroups.com.


Re: Not sure if I am doing django-paypal correctly

2021-12-30 Thread lone...@gmail.com
Hey man, beggars cannot be choosers!  Thank you!

On Thursday, December 30, 2021 at 1:28:12 AM UTC-5 Yorben Verhoest wrote:

> Hello
>
> I'm a Django Noobie and maybe I'm completely wrong about this but in my 
> app named "core", I have a file called apps.py where I register my signals.
> I just followed a tutorial as well so I can't yet explain what it does but 
> if I had to guess is just to register the app with my signals.
>
> Just when reading your question it reminded me of this:
> [image: appconfig.png]
>
> If this is wrong info I'll delete this but maybe this helps :)
>
> Regards
>
> On Wednesday, 29 December 2021 at 21:22:46 UTC+1 lone...@gmail.com wrote:
>
>> Hello all,
>>
>>   I decided to try and accept payments on my web application.  I have 
>> chosen the django-paypal application to help me out with this task.  I 
>> found a decent walkthrough at: 
>> how-to-accept-paypal-payments-on-your-django-application 
>> <https://www.guguweb.com/2021/01/12/how-to-accept-paypal-payments-on-your-django-application/>.
>>   
>> I was able to follow everything until the last step of: "6. Setup a 
>> listener to detect successful Paypal payments"  I have never really setup 
>> any listeners before so I did not know what to do.  I decided to read the 
>> Django-PayPal 
>> ReadTheDocs 
>> <https://django-paypal.readthedocs.io/en/stable/standard/ipn.html> and I 
>> found a file that looked structurally similar to what I found on the 
>> original walkthrough I had found.  It looks like I needed to make a 
>> hooks.py file in my project directory.  I have accomplished that, and the 
>> ReadTheDocs says: "Remember to ensure that import the hooks file is 
>> imported i.e. that you are connecting the signals when your project 
>> initializes. The standard way to do this is to create an AppConfig class 
>> <https://docs.djangoproject.com/en/2.1/ref/applications/#configuring-applications>
>>  and 
>> add a ready() 
>> <https://docs.djangoproject.com/en/2.1/ref/applications/#django.apps.AppConfig.ready>
>>  method, 
>> in which you can register your signal handlers or import a module that does 
>> this."  This is where I am getting lost.  I am not quite sure what to 
>> do.  Does anyone have a better walkthrough or know what I need to do?
>>
>> 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/db143e07-597c-489a-ace7-9bb5847ef69an%40googlegroups.com.


Re: Not sure if I am doing django-paypal correctly

2021-12-31 Thread lone...@gmail.com
I found a better article at: Better Django-paypal article 
<https://overiq.com/django-paypal-integration-with-django-paypal/>.  For 
the most part, it does a really thorough explanation of what needs to be 
done.  There were some things that I had to adjust myself, but that was 
easy enough.  My God, I feel like I just ran a mental marathon.

On Thursday, December 30, 2021 at 10:51:57 PM UTC-5 Joel T wrote:

> The code is really simple to implement, but I don't think the explanation 
> was intuitive enough.
>
> You would need to create a signal like so
>
> #hooks.py
> from django.dispatch import Signal
>
> success_signal = Signal(providing_args=[])
>
> #views.py
> from .hooks import success_signal
> ... # after payment
>
> success_signal.connect(handler_function)
> success_signal.send(sender=None, **kwargs)
>
> This assumes that you already have a listener waiting for the signal 
> broadcast, 
> Also replace None with your sender (optional), and replace **kwargs with 
> any kwargs you're sending to your listeners. 
>
> Cheers 
>
>
> On Wed, Dec 29, 2021, 9:23 PM lone...@gmail.com  wrote:
>
>> Hello all,
>>
>>   I decided to try and accept payments on my web application.  I have 
>> chosen the django-paypal application to help me out with this task.  I 
>> found a decent walkthrough at: 
>> how-to-accept-paypal-payments-on-your-django-application 
>> <https://www.guguweb.com/2021/01/12/how-to-accept-paypal-payments-on-your-django-application/>.
>>   
>> I was able to follow everything until the last step of: "6. Setup a 
>> listener to detect successful Paypal payments"  I have never really setup 
>> any listeners before so I did not know what to do.  I decided to read the 
>> Django-PayPal 
>> ReadTheDocs 
>> <https://django-paypal.readthedocs.io/en/stable/standard/ipn.html> and I 
>> found a file that looked structurally similar to what I found on the 
>> original walkthrough I had found.  It looks like I needed to make a 
>> hooks.py file in my project directory.  I have accomplished that, and the 
>> ReadTheDocs says: "Remember to ensure that import the hooks file is 
>> imported i.e. that you are connecting the signals when your project 
>> initializes. The standard way to do this is to create an AppConfig class 
>> <https://docs.djangoproject.com/en/2.1/ref/applications/#configuring-applications>
>>  and 
>> add a ready() 
>> <https://docs.djangoproject.com/en/2.1/ref/applications/#django.apps.AppConfig.ready>
>>  method, 
>> in which you can register your signal handlers or import a module that does 
>> this."  This is where I am getting lost.  I am not quite sure what to 
>> do.  Does anyone have a better walkthrough or know what I need to do?
>>
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d9567663-20fb-4f43-a6c5-131f23497a7bn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/d9567663-20fb-4f43-a6c5-131f23497a7bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/c8058264-9dda-443c-963f-18a8edfc4737n%40googlegroups.com.


When I redirect to a previously used view old data is used

2022-01-17 Thread lone...@gmail.com
Hello all,

I have a redirect that redirects to a previously used view.  The data 
in the view should change, and does, once I reload the page.  How can I get 
the new page without reloading the page first?  For clarity, here is the 
basic process I have defined so far.

1. View is loaded and everything looks great.
2. Eventually, the user goes through a redirect that points to the original 
view in step 1.
3. Once they are on the same view as step 1, the old data is present.  I 
have a to right-click and reload the page for the new data to appear on the 
view.

What am I missing?

-- 
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/c2a02648-8f76-40d7-b39e-66c4c83429d8n%40googlegroups.com.


Re: Lack of tutorials and explanations about channels

2022-01-24 Thread lone...@gmail.com
You and me both are on the same page about documentation about Channels.  I 
tried to follow: Django Channels Tutorial 🔥: the most minimal Real Time 
app (not Chat) | Django WebSockets 
 on YouTube, but I kept 
running into issues.  If you can follow this video, and figure it out, let 
me know if it is missing something.

On Wednesday, November 10, 2021 at 8:48:31 AM UTC-5 Dossou Mawussekuifan 
Gloria Donald KANTI wrote:

> Why aren't there much tutorials and explanations about Channels and 
> websocket integration in django over the internet ? Quite confusing. How 
> can we get to know and understand it more if nobody wants to explain it. I 
> am new to python and drf, wanna implement some realtime features in my app 
> but no chance to get good resources explaining very well how things can be 
> done. If there are some pros here knowing very well about the topic please, 
> write some blog or make some detailed youtube videos to explain the topic. 
> It will really help me and others in the future. It is crucial also for the 
> image of django. 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/902feb53-0009-4e5b-946e-4f027daa64a6n%40googlegroups.com.


Re: Lack of tutorials and explanations about channels

2022-01-25 Thread lone...@gmail.com
Well, I did it.  I frankensteined my way to a working Django 3.0+ and 
Channels 3.0 demo project!  Here is where I went.  I started at: 
https://testdriven.io/blog/django-channels/#add-channels. I cannot stress 
this enough, I started at the add-channels section!  During my time in 
following the instructions, I had to install Redis from source and I found 
those instructions at: https://realpython.com/python-redis/ Once I was done 
installing from source, I was back to following the first URL's 
instructions.  I figured out that I had to start the redis server with 
redis-server command.  This is how you are able to complete the below 
commands.  This is where I stopped following the instructions from the 
first URL.
>>> import channels.layers 
>>> channel_layer = channels.layers.get_channel_layer()
>>> from asgiref.sync import async_to_sync 
>>> async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'}) 
>>> async_to_sync(channel_layer.receive)('test_channel') {'type': 'hello'}

I finished things off with the YouTube video of: 
https://www.youtube.com/watch?v=R4-XRK6NqMA&t.  That is the best I can do 
you right now.  My brain is mush.

On Monday, January 24, 2022 at 2:59:52 PM UTC-5 stevesm...@hotmail.com 
wrote:

> I am a huge fan of Django.  But I will agree that the documentation is 
> most areas beyond the absolute basics is abysmal.  I have a lot written in 
> Django in Class Based Views because I read early on they were the way to 
> go.  I'm not going to tell you how much research and time it took me but it 
> was a lot.  Django is super powerful and it's amazingbut the 
> documentation...while maybe better than any other framework is still very 
> lacking for people in my humble opinion.  The documentation and books that 
> I've come across are written in a way that they assume you already 
> understand it and they pick up from there.  Love django.  Agree with the 
> comment about documentation about Channels and as I've expressed most of 
> the other documentation as well.
>
>
>
> --
> *From:* django...@googlegroups.com  on behalf 
> of lone...@gmail.com 
> *Sent:* Monday, January 24, 2022 6:03 AM
> *To:* Django users 
> *Subject:* Re: Lack of tutorials and explanations about channels 
>  
> You and me both are on the same page about documentation about Channels.  
> I tried to follow: Django Channels Tutorial 🔥: the most minimal Real 
> Time app (not Chat) | Django WebSockets 
> <https://www.youtube.com/watch?v=R4-XRK6NqMA> on YouTube, but I kept 
> running into issues.  If you can follow this video, and figure it out, let 
> me know if it is missing something.
>
> On Wednesday, November 10, 2021 at 8:48:31 AM UTC-5 Dossou Mawussekuifan 
> Gloria Donald KANTI wrote:
>
> Why aren't there much tutorials and explanations about Channels and 
> websocket integration in django over the internet ? Quite confusing. How 
> can we get to know and understand it more if nobody wants to explain it. I 
> am new to python and drf, wanna implement some realtime features in my app 
> but no chance to get good resources explaining very well how things can be 
> done. If there are some pros here knowing very well about the topic please, 
> write some blog or make some detailed youtube videos to explain the topic. 
> It will really help me and others in the future. It is crucial also for the 
> image of django. 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...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/902feb53-0009-4e5b-946e-4f027daa64a6n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/902feb53-0009-4e5b-946e-4f027daa64a6n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/ffb2fc74-5825-461b-9214-e210ddf49ab5n%40googlegroups.com.


Can I use session.userid in models FK restriction query?

2022-02-11 Thread lone...@gmail.com
Hello all,

 I am curious if I can use the session.userid in a model FK restriction 
query.

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/18762bd6-5b1d-4397-b76d-e95e8a12f2ean%40googlegroups.com.


Generating Calendar files for iPhone and Android with Pthon3/django

2022-08-01 Thread lone...@gmail.com
Hello all,

 I want to generate calendar files for both Android and iPhone.  I do 
not want to connect to the Google or Apple APIs to do this.  I just want 
static files that are downloaded from my webapp to the mobile device.  How 
and can this be done?

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/b88bf3da-a699-484e-84dd-61fb929e4e8dn%40googlegroups.com.


Re: Generating Calendar files for iPhone and Android with Pthon3/django

2022-08-02 Thread lone...@gmail.com
I found: https://pypi.org/project/icalendar/.  Are there any others out 
there?

On Tuesday, August 2, 2022 at 10:41:44 AM UTC-4 Ryan Nowakowski wrote:

> The standard is called iCal. There are a few different python libraries to 
> choose from.
>
>
> On August 1, 2022 2:51:34 PM CDT, "lone...@gmail.com"  
> wrote:
>>
>> Hello all,
>>
>>  I want to generate calendar files for both Android and iPhone.  I do 
>> not want to connect to the Google or Apple APIs to do this.  I just want 
>> static files that are downloaded from my webapp to the mobile device.  How 
>> and can this be done?
>>
>> 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/fab30b9f-5afd-459e-9186-f798baedefe5n%40googlegroups.com.


Re: Generating Calendar files for iPhone and Android with Pthon3/django

2022-08-03 Thread lone...@gmail.com

well well well.  Look what I found.  https://ical.marudot.com/  I played 
around with the site a little bit and it generated what I was looking for.  
I was looking for a data structure for the Reminder feature of an Event 
object.  What I am doing in my own code is just one long string with 
variables in it.
On Wednesday, August 3, 2022 at 5:02:19 AM UTC-4 christian...@gmail.com 
wrote:

> icalendar is tried and tested and feature complete. 
> OTOH if you want just to serve the iCal files from Google or Apple you 
> don't even need to parse then, just pass them on?
>
> On Tue, 2 Aug 2022 at 15:48, lone...@gmail.com  wrote:
>
>> I found: https://pypi.org/project/icalendar/.  Are there any others out 
>> there?
>>
>> On Tuesday, August 2, 2022 at 10:41:44 AM UTC-4 Ryan Nowakowski wrote:
>>
>>> The standard is called iCal. There are a few different python libraries 
>>> to choose from.
>>>
>>>
>>> On August 1, 2022 2:51:34 PM CDT, "lone...@gmail.com"  
>>> wrote:
>>>>
>>>> Hello all,
>>>>
>>>>  I want to generate calendar files for both Android and iPhone.  I 
>>>> do not want to connect to the Google or Apple APIs to do this.  I just 
>>>> want 
>>>> static files that are downloaded from my webapp to the mobile device.  How 
>>>> and can this be done?
>>>>
>>>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/fab30b9f-5afd-459e-9186-f798baedefe5n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/fab30b9f-5afd-459e-9186-f798baedefe5n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Best Regards,
>
> Christian Ledermann
>
> Galway, IE
> Mobile : +353 (0) 899748838
>
> https://www.linkedin.com/in/christianledermann
> https://github.com/cleder/
>
>
> <*)))>{
>
> If you save the living environment, the biodiversity that we have left,
> you will also automatically save the physical environment, too. But If
> you only save the physical environment, you will ultimately lose both.
>
> 1) Don’t drive species to extinction
>
> 2) Don’t destroy a habitat that species rely on.
>
> 3) Don’t change the climate in ways that will result in the above.
>
> }<(((*>
>

-- 
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/82264155-a7ec-49f2-a752-ac91c826809cn%40googlegroups.com.


converting CURL command

2022-08-21 Thread lone...@gmail.com
Hello all,

   I am interested in converting the CURL command of:

curl 'https://www.walmart.com/chcwebapp/api/receipts' \ -H 'sec-ch-ua: 
"Chromium";v="98", " Not A;Brand";v="99", "Google Chrome";v="98"' \ -H 
'accept: application/json' \ -H 'Referer: 
https://www.walmart.com/receipt-lookup' \ -H 'content-type: 
application/json' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'User-Agent: Mozilla/5.0 
(Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) 
Chrome/98.0.4758.102 Safari/537.36' \ -H 'sec-ch-ua-platform: "Mac OS X"' \ 
--data-raw 
'{"storeId":"123","purchaseDate":"02-19-2022","cardType":"visa","total":"100.00","lastFourDigits":"1234"}'
 
\ --compressed

to a management command in Django.  Anyone have any documentation on how to 
do this?

-- 
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/53723979-3323-4563-9799-9091354d87a9n%40googlegroups.com.


Checking API Results before saving

2022-09-01 Thread lone...@gmail.com
Hello all,

I am sending an GET request to an external API and I would like to 
validate the response before I save it to my model.  How do I do this?

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/0b724dc1-cb08-4168-8cc0-a5eac8a7c011n%40googlegroups.com.


Re: Checking API Results before saving

2022-09-02 Thread lone...@gmail.com
Ok, I have a CreateView.  The process I have now is:
blank form is created by CreateView
After I submit the data to the form, I have a post_save that calls a 
function that queries the API based on the values entered in the form.

When and how do I call the serializer during this process?

On Friday, September 2, 2022 at 3:15:00 AM UTC-4 amarb...@gmail.com wrote:

> Hello ,
>
> You can design a serializer for each api endpoint and use it in your view 
> to validate your data like validating forms data :
> Pseducode :
> res = requests.post(url+some_endpoint, data)
> endpoint_serializer.validate(res.data)
> if serializer.is_valid():
> #do your stuff
> else :
> #do something 
>
> Best Regards 
>
> Ammar Mohammed
>
> On Fri, 2 Sep 2022, 01:41 lone...@gmail.com,  wrote:
>
>> Hello all,
>>
>> I am sending an GET request to an external API and I would like to 
>> validate the response before I save it to my model.  How do I do this?
>>
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/0b724dc1-cb08-4168-8cc0-a5eac8a7c011n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/0b724dc1-cb08-4168-8cc0-a5eac8a7c011n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/0e1c1af9-f423-4e3a-ba62-55cc60efd8c5n%40googlegroups.com.


Re: Checking API Results before saving

2022-09-02 Thread lone...@gmail.com
I have been working on this issue.  Here is what I have so far.

My Model and pre_save 
information:
class walmart_query_history(models.Model):
storeNumber = models.CharField(max_length=10)
receiptDate = models.DateField(auto_now=False, auto_now_add=False)
cardType = models.ForeignKey(walmart_query_history_card_type, 
on_delete=models.CASCADE)
purchaseAmount = models.DecimalField(max_digits=13, decimal_places=2)
lastFour = models.CharField(max_length=4)

class Meta:
unique_together = (('receiptDate', 'purchaseAmount'),)

def validate_response_ask_walmart(*args, instance, **kwargs):
pewee = instance.receiptDate
pewee = pewee.strftime('%m-%d-%Y')
data = call_command('validate_response_query_walmart', 
instance.storeNumber, str(pewee), instance.cardType, 
str(instance.purchaseAmount), instance.lastFour)
valid_ser = ValidateFormSerializer(data=data)
if valid_ser.is_valid():
post_data = valid_ser.validated_data
else:
print(valid_ser.errors)
pre_save.connect(validate_response_ask_walmart, 
sender=walmart_query_history)

Contents of my validate_response_ask_walmart 
file:
class Command(BaseCommand):
help = 'Reads Receipts'

def add_arguments(self, parser):
parser.add_argument('storeId', type=str)
parser.add_argument('purchaseDate', type=str)
parser.add_argument('cardType', type=str)
parser.add_argument('total', type=str)
parser.add_argument('lastFourDigits', type=str)

def handle(self, *args, **options):

url = "https://www.walmart.com/chcwebapp/api/receipts";

data = {
"storeId": options['storeId'],
"purchaseDate": options['purchaseDate'],
"cardType": options['cardType'],
"total": options['total'],
"lastFourDigits": options['lastFourDigits']
}
storeId = data['storeId']

headers = {
'sec-ch-ua': '"Chromium";v="98", " Not A;Brand";v="99", "Google 
Chrome";v="98"',
'accept': 'application/json',
'Referer': 'https://www.walmart.com/receipt-lookup',
'content-type': 'application/json',
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36',
'sec-ch-ua-platform': '"Mac OS X"'
}
 
response = requests.post(url, json=data, headers=headers)
# Good documentation about requests response codes.
# https://www.w3schools.com/python/ref_requests_response.asp

#print("Status Code", response.status_code)
#print(response.text)
#print("JSON Response ", response.json())
base_JSON = response.json()
#tester = base_JSON
#return json.dumps(base_JSON, indent=4)
self.stdout.write(type(base_JSON))


My serializer 
file---
from rest_framework import serializers

class ValidateFormSerializer(serializers.Serializer):
tcNumber = serializers.CharField(max_length=255, 
source='receipts[0]tcNumber')



I keep getting the error code of:
AttributeError: type object 'dict' has no attribute 'endswith'

What am I missing?
On Friday, September 2, 2022 at 4:39:53 AM UTC-4 lone...@gmail.com wrote:

> Ok, I have a CreateView.  The process I have now is:
> blank form is created by CreateView
> After I submit the data to the form, I have a post_save that calls a 
> function that queries the API based on the values entered in the form.
>
> When and how do I call the serializer during this process?
>
> On Friday, September 2, 2022 at 3:15:00 AM UTC-4 amarb...@gmail.com wrote:
>
>> Hello ,
>>
>> You can design a serializer for each api endpoint and use it in your view 
>> to validate your data like validating forms data :
>> Pseducode :
>> res = requests.post(url+some_endpoint, data)
>> endpoint_serializer.validate(res.data)
>> if serializer.is_valid():
>> #do your stuff
>> else :
>&g

Using one query set for another query

2023-03-28 Thread lone...@gmail.com
Hello all,

I am trying to use the query of:
paid_bills = bill_payment_history.objects.filter(date_paid__year='2023', 
date_paid__month='03')

as criteria for another query to only show the unpaid bills.

The known_bills model is my control list of known bills that occur 
frequently.
The  bill_payment_history model is my bill transaction table.  It is a 
running history of transactions for bill payment.

A sample of known_bills records is:
bill_1
bill_2
bill_3

A sample of  bill_payment_history is:
bill_1 paid last month
bill_2 paid last month
bill_3 paid last month
bill_1 paid this month
bill_2 paid this month
bill_3 paid this month

What I am trying to do is use bill_payment_history filtered on date_paid by 
year and month and query the known_bills table to see what bills have not 
been paid yet.  I keep trying something similar to:  results = 
paid_bills.exclude(short_description__in=known_bills)

but my results either keep coming up with all of the records or none of 
them.  What am I doing wrong?

Here is the model information:

class known_bills(models.Model):
#Full bank transaction
description = models.CharField(max_length=255)
#String value to search the CSV file with.
short_description = models.CharField(max_length=255, unique=True)
#Value I know it as.
friendly_name = models.CharField(max_length=255)
expected_due_date = models.DateField()
expected_cost = models.DecimalField(max_digits=6,decimal_places=2)

class bill_payment_history(models.Model):
description = models.CharField(max_length=255)
short_description = models.ForeignKey(known_bills, 
on_delete=models.CASCADE)
friendly_name = models.CharField(max_length=255)
date_paid = models.DateField()
cost = models.DecimalField(max_digits=6,decimal_places=2)

class Meta:
unique_together = (
('short_description',
'date_paid'),
)

-- 
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/6a9327f8-6a00-49d2-8411-bd9fb03c64c0n%40googlegroups.com.


Testing Django User Login Form

2021-04-18 Thread lone...@gmail.com
Hello all,

I am not sure what I am doing incorrectly with the below test case 
information.  I am simply trying to test the default authentication form of 
django 3.1.  This test should be a good/True login test.

Here is the Test case:-
class TestForms(TestCase):
def test_invalid_username(self):
# The user submits an invalid username.
data = {
'username': 'abc',
'password': 'password',
}
form = AuthenticationForm(None, data)
self.assertTrue(form.is_valid())


Here is what I am getting for output:

FAIL: test_invalid_username (rucklogs.tests.TestForms)
--
Traceback (most recent call last):
  File "/home/lonesoac0/django/rucker2021/rucklogs/tests.py", line 39, in 
test_invalid_username
self.assertTrue(form.is_valid())
AssertionError: False is not true
---

As you can see in the attached screenshot, the user abc is a good user.

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/5acae9ea-ae51-438b-8c31-6b926581d3d1n%40googlegroups.com.


Re: Testing Django User Login Form

2021-04-23 Thread lone...@gmail.com
Thank you for the reply!  I will totally try this tonight!

On Thursday, April 22, 2021 at 7:31:40 PM UTC-4 David Nugent wrote:

> Try creating a request using RequestFactory and use that to input the 
> credentials. I don't think the way you are creating the form is valid.
>
> rf = RequestFactory()
> request = rf.post('/some_mock_url', dict(username='abc', 
> password='password'))
> form = AuthenticationForm(request)
>
>

-- 
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/e3079f83-6175-4852-9a6a-f94625079af4n%40googlegroups.com.


GeoDjango Hosting

2023-11-15 Thread lone...@gmail.com
Hello all,

I am looking for a webhosting service that allows me to install qgis 
software packages on the webhost.  My preferred hosts are either Ubuntu or 
Debian.  Anyone know of any good solutions?

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/e106b78b-847a-451c-87d2-33bb246185f8n%40googlegroups.com.


Django and QGIS Dockerimage

2023-11-20 Thread lone...@gmail.com
Hello all,

  I am playing around with Docker for the first time and would like to go 
over what I have done so far.  For one docker image, I want to add Django 
and QGIS in one image.  I think I have done that with the Dockerfile 
containing:

"FROM python:3
FROM qgis/qgis
ENV PYTHONUNBUFFERED=1
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/"

and the docker-compose.yml file of:
"version: "3.9"

services:
  qgis:
image: qgis
  web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
 - .:/code
ports:
 - "8000:8000"
depends_on:
  - qgis
"

The requirements.txt file contains:
"Django>=4.0, <5.0
psycopg2-binary>=2.8
"

The docker image that I created that has both Django and QGIS is a little 
bit bigger than the vanilla qgis docker image, so I think I have them both 
in an image.  How can I perform a simple test to try and verify?

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/70b1e978-cb18-4a5a-9e55-c271b8f6644en%40googlegroups.com.


Simple Ajax Search

2023-11-23 Thread lone...@gmail.com
Hello all,

   I am looking for a simple how-to on creating an interactive search on a 
text field.  As the user types the search results change and the user can 
click on the search result that they want.  I have installed jquery3 and 
bootstrap5 in my django project.

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/6bc300c2-1d1f-4e87-90bb-1311e2120c77n%40googlegroups.com.


Re: Simple Ajax Search

2023-11-23 Thread lone...@gmail.com

A stipulation that I forgot to mention is that the desired drop down 
selections will be coming from an external API. I did not see the package 
calling out to an external API, will this still work?
On Thursday, November 23, 2023 at 9:09:11 AM UTC-5 Thomas Couch wrote:

> I think Select2 is a well trodden path for this sort of thing (unless I'm 
> mistaken, it's already available in the admin interface). Have a look at 
> the django-select2 package: 
> https://django-select2.readthedocs.io/en/latest/
>
> On Thursday, November 23, 2023 at 12:36:23 PM UTC lone...@gmail.com wrote:
>
>> Hello all,
>>
>>I am looking for a simple how-to on creating an interactive search on 
>> a text field.  As the user types the search results change and the user can 
>> click on the search result that they want.  I have installed jquery3 and 
>> bootstrap5 in my django project.
>>
>> 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/83db2704-8e5f-4e54-bcfa-3c4b1b6ed7f7n%40googlegroups.com.


Connecting Django with Redis

2023-11-27 Thread lone...@gmail.com
Hello all,

   I wanted to verify the connection between my django and Redis was 
working and I found this article: 
https://studygyaan.com/django/connect-django-with-redis  I have already 
implemented what it asked and I got good results.  I am kind of curious 
though, can I use the instructions with the django testing framework?

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/043e7f27-7407-4a89-a307-1de1b2fb74ccn%40googlegroups.com.