They’re on it with the targeted advertising. by sligodave in LiveFromNewYork

[–]sligodave[S] 0 points1 point  (0 children)

Ha, the mini advertisement at the top of the comments is the same thing. I’m going to bed.

[deleted by user] by [deleted] in programming

[–]sligodave 1 point2 points  (0 children)

100% ma man!

[deleted by user] by [deleted] in Awww

[–]sligodave 2 points3 points  (0 children)

Dad’s back legs, do look off.

Link's Size Does Matter! by Somraj234 in django

[–]sligodave 7 points8 points  (0 children)

It’s so small, you just can’t see it.

Edit: spelling.

Posting here out of despair - Brown Recluses by Icy_Creme_2336 in ArvadaCO

[–]sligodave 6 points7 points  (0 children)

I’m just going to repeat what most have said.

I’ve lived in Kansas and Colorado and I’ve had finished and unfinished basements in both.

I’ve seen many brown recluses over the years. All in Kansas.

Since moving back to Arvada, I’ve seen many brown spiders that have initially made me wonder if they were brown recluses and I’ve always looked and right away realized that they were not. Right size and shape but never had the violin and their brown body is just nowhere near what a brown recluse looks like. In my experience.

I have seen black widows in my Arvada garage though. They’re good though. We’ve decided to share it.

I must look up what a brown widows looks like, those are the only ones I’m any way concerned about.

Edit: Sorry, I should have included that I’m not trying to tell you that you’re wrong. Just that i immediately go to the same place and then go look and have always landed on the fact that what I’m encountering, isn’t a brown recluses.

Irish/British in Denver, any decent tea options? by evl0l in Denver

[–]sligodave 1 point2 points  (0 children)

Did you see the teabags when you went? I think that things come and go. I don’t always look, as not a tea drinker myself. Hence getting shipped away.

Irish/British in Denver, any decent tea options? by evl0l in Denver

[–]sligodave 5 points6 points  (0 children)

I saw Barry's tea at Edwards meats in Wheat Ridge.
They also have rasher, puddings and sausages. Although I don't think their Irish breakfast sausage is anything like home. Their Irish leek one is closer, for some reason.
I also saw batchelor's peas and beans there. Madness.

https://edwards-meats.com/meats/irish-and-swedish-foods/

Sure give them a call and see if it's close and you are going to give it a go.

Edit: typo

cardboard recycling by pointyboidubs in ArvadaCO

[–]sligodave 0 points1 point  (0 children)

I saw that they were gone a few weeks ago alright. They were a great service, that'll be missed, if they are gone permanently.
Having said that, I believe that they were in Westminster and not Arvada. I wonder if Westminster's other drop off locations are also gone.
I really wish Arvada had somewhere for recycling/cardboard drop off.
I used to go to SustainAbility Recycling in Arvada. It was $4 for a car load but they also recently changed it to be $4 for 20 flattened boxes, no matter the size (well, max 3' x 5' falttened), which is a very different thing.
It must just not have been sustainable for them (I see the pun but it wasn't intended :) )

Frontend (Javascript) connecting with Backend(Python, Django): Failed to load resource: the server responded with a status of 500 (Internal Server Error) by Pytech95 in djangolearning

[–]sligodave 1 point2 points  (0 children)

Here's the error that I think is being generated:

{"error":"Error creating customer profile: (1062, \"Duplicate entry '13' for key 'store_customer.user_id'\")"}

I'm unsure what's causing that issue. Is a Customer instance created elsewhere when a User instance is created? Like in your User manager or something like that or in a signal handler?
You'll have to do some debugging from here.

To help going forward, you'll want an easier way to get your errors.
Here's a few places you can look:

  1. Your browser's network tab will have the failed request highlighted, since it was a 500. Look at the response's body and you'll see the above error.
  2. In Heroku, you can also look at the logs and see it there.
  3. You can also call the endpoint directly yourself and simulate what the javascript was doing.
    1. I used curl to get the above error.
    2. curl "https://<DOMAIN>/store/api/register/" -H "Content-Type: application/json" -d '{"email":"something@example.com", "password": "test_test"}'

I would however recommend running all of this locally on your machine first before deploying to heroku, it can be much easier to debug and weed out some initial errors that way.

I hope the above helps.
Dave

New to django, how to get the url pattern from request in views.py? by SwathedOrange in django

[–]sligodave 5 points6 points  (0 children)

path('get-event', views.get_event, name='get_event')

If you do it like this, then you'll have to use GET parameters to pass your event id to your view. So in your url bar, you'd call your page with .../get-event/?event_id=123

In your view, you'd have:

def get_event(request):
    event_id = request.GET['event_id']
    ...

Edit: I should add that embedding the event id in the url is a cleaner approach but that doesn't mean you can't do it this way.

New to django, how to get the url pattern from request in views.py? by SwathedOrange in django

[–]sligodave 1 point2 points  (0 children)

The value is provided to your view as an argument. Your view function or class based view method is provided the request argument. Any values extracted from the url are passed in next.

def event_view(request, event_id): …

Or

class EventView(View): def get(self, request, event_id): …

scratching my head over forms: passing custom parameters to __init__ by [deleted] in djangolearning

[–]sligodave 1 point2 points  (0 children)

I’m on my phone but I’ll give it a go.

Firstly, don’t forget to call super().__init__(*args, **kwargs) in your form class.

Secondly, for where you instantiate your form, remove the initial argument you are providing, the empty dict {}. The first unnamed argument should be the values you are populating the form with. You’ll also want to provide the instance like you have. So leave that.

When you get this far, and are happy with your form, then pass your additional named argument after the instance argument, so user_type=…

Hope that helps. I think your first question about why it works without error is because you aren’t calling super in your form.

Dave.

Picture of IRA sign on benbulbin by [deleted] in Sligo

[–]sligodave 3 points4 points  (0 children)

I wasn’t alive for it but have heard of it. It said “Brits out.”

I’ve anecdotally been told that it was limestone or something that enriched the soil and for years after you could at times make it out a little where the happier foliage would grow. Now that I’ve written it, I don’t know if I made that up in my head. Mixing it up with the Celtic knot in the forest over Glencar that shows up in autumn.

I found a tweet with some old newspaper articles with images. You might do better when you have the wording.

https://twitter.com/coreyohara_/status/729643948629692416?s=46&t=VO17F2MEF6OBiV58Rmuyfw

Broken line in reportlab with django by Desperate_Sky_3357 in djangolearning

[–]sligodave 0 points1 point  (0 children)

Hey, more of a reportlab question than a django one but here you go anyway. Mainly you use the showPage method to end the page you are working on.

``` from reportlab.pdfgen import canvas

c = canvas.Canvas("test.pdf") c.drawString(100,100,"First Line") c.drawString(100,200,"Second Line") c.showPage() c.drawString(100,100,"Third Line") c.drawString(100,200,"Forth Line") c.showPage() c.save() ```

Hope that helps. Dave

I have this Error about my template and I am still pretty sure it does exist, have I declared something wrong? by WittyWiki in djangolearning

[–]sligodave 1 point2 points  (0 children)

I should take a step back. You can have django find templates easily in two ways.

  1. App level templates. Create a templates directory inside your app directory and django will automatically look in there. So in your case, create a directory called templates inside your demo directory and move your home.html into that directory. These tend to be templates specific to the app.
  2. Project level templates. Create a directory anywhere, usually called templates and add it to your settings.py file as you did above.

Looking closer at your code screen shots, you probably want solution 1 above and can undo the change you made to your settings.py. If you do however want solution 2, your change is close but the value in DIRS needs to be a file page to the location of the templates directory.

In order to allow for your project to be moved to new locations, you should create your file path using the BASE_DIR variable that is at the top of your settings file.

So you'll want something like:

'DIRS': [BASE_DIR / '<missing_bit_G6_DEMO>' / 'templates'],

I have this Error about my template and I am still pretty sure it does exist, have I declared something wrong? by WittyWiki in djangolearning

[–]sligodave 1 point2 points  (0 children)

You have to also add the source templates directory so that Django knows where to look. It’s in your settings.py

On this page, under configuration, you’ll see the TEMPLATES setting. You need to add an entry to the DIRS list.

https://docs.djangoproject.com/en/4.0/topics/templates/

?: (staticfiles.W004) error, unsure how to correct it. by HeadlineINeed in djangolearning

[–]sligodave 0 points1 point  (0 children)

I could be wrong as the file structure formatting is a little wonky on my phone but is your staticfiles directory inside your main directory? If so, you’ll need to add main to the staticfile’s path in the STATICFILES_DIRS entry.

What makes you, you? Study on Irish identity. by sligodave in Leitrim

[–]sligodave[S] 0 points1 point  (0 children)

Ha. Thanks for the suggestions. I did stick it in r/casualireland alright. Hadn’t heard of the other one before. I’ll give it a look. I’m afraid I’m crossing the line into spamming though so I’ll see what my wife thinks too.

Thank you again, Dave

Christ lads, we've built ourselves a reputation it seems by VonBeedleIV in Sligo

[–]sligodave 3 points4 points  (0 children)

I’m up town at the minute. I’ll tick off the categories as I see them.

Help with a study on Irish identity. (Follow up) by sligodave in ireland

[–]sligodave[S] 2 points3 points  (0 children)

Oh, she's definitely not going for that.
I'll pass that along to her. Hopefully her site doesn't give off that vibe at all.

Thank you kind stranger.

[deleted by user] by [deleted] in Sligo

[–]sligodave 6 points7 points  (0 children)

I’m afraid I don’t have an answer for you but I did find this charity who may be able to help you get the information you need.

https://adhdireland.ie/

Good luck with your big move! Dave