Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: regex and case insensitive
Post: RE: regex and case insensitive

(Jul-19-2020, 08:53 PM)bowlofred Wrote: Can you give an example of what one of your $regex is set to? Looks like mongo can take the perl-style /$regex/i form. I made it, after checking 200...
Leon79 General Coding Help 8 3,188 Jul-20-2020, 11:04 AM
    Thread: regex and case insensitive
Post: RE: regex and case insensitive

(Jul-19-2020, 08:31 PM)bowlofred Wrote: I'm assuming it's just keyword. So try instead of your line 5, something like: keyword = "(?i)" + str(data['mysearch']) no it doesn't work at all on this w...
Leon79 General Coding Help 8 3,188 Jul-19-2020, 08:37 PM
    Thread: regex and case insensitive
Post: RE: regex and case insensitive

(Jul-19-2020, 08:26 PM)bowlofred Wrote: Did you try what I said above? Add "(?i)" to the front of the regex. No because I don't know exactly where to put it sorry **confused**
Leon79 General Coding Help 8 3,188 Jul-19-2020, 08:28 PM
    Thread: regex and case insensitive
Post: RE: regex and case insensitive

(Jul-19-2020, 07:57 PM)bowlofred Wrote: I don't see what's actually doing the lookup. But if render_template uses python regex engine, you can probably add a (?i) to the beginning of the regex. &g...
Leon79 General Coding Help 8 3,188 Jul-19-2020, 08:13 PM
    Thread: regex and case insensitive
Post: regex and case insensitive

Hello Coders, I have almost solved with my little search bar, just I cannot manage to look for the word with case insensitive, if I write parmesan it finds it, all work normally, if I write ParMeSan ...
Leon79 General Coding Help 8 3,188 Jul-19-2020, 06:44 PM
    Thread: find a string in a field in MongoDB
Post: RE: find a string in a field in MongoDB

I have almost solved, just I cannot manage to look for the word with case insensitive, if I write parmesan it finds it, if I write ParMeSan it doesn't. Any Idea? @app.route('/search', methods=["POST"...
Leon79 General Coding Help 2 2,406 Jul-19-2020, 06:38 PM
    Thread: find a string in a field in MongoDB
Post: find a string in a field in MongoDB

Hello coders, I'm a student and I've almost finished my project for my course. As last thing I added a small search bar in the index.html in order to submit an ingredient, and through search.html I w...
Leon79 General Coding Help 2 2,406 Jul-19-2020, 05:15 PM
    Thread: filtering by category flask+mongodb
Post: RE: filtering by category flask+mongodb

(Jul-18-2020, 05:18 PM)ndc85430 Wrote: Did you mean to put your dict inside a set on line 3? Thanks man, I just wrote query={{"category_name": "Vegetarian"}} that actually had to be query={"category...
Leon79 Web Scraping & Web Development 3 8,864 Jul-18-2020, 05:44 PM
    Thread: filtering by category flask+mongodb
Post: filtering by category flask+mongodb

Hi coders! I'm dividing every page by filtering by the correct category in my recipe blog, but I don't know why I cannot manage. For example, I have vegetarian.html, It works when I simply don't look ...
Leon79 Web Scraping & Web Development 3 8,864 Jul-18-2020, 05:09 PM
    Thread: form select option tags, add "selected" on <option> in python at a condition
Post: RE: form select option tags, add "selected" on <op...

(Jul-12-2020, 05:40 PM)DeaD_EyE Wrote: <option value="meatfish" {{ 'selected' if recipe.category_name == 'meatfish' else '' }} >Meat&Fish</option>You could use the expression syntax ...
Leon79 Homework 3 2,620 Jul-14-2020, 05:00 PM
    Thread: delete a file works but with error
Post: RE: delete a file works but with error

(Jul-13-2020, 05:31 PM)DPaul Wrote: without seeing the details, you can delete a file only once. Assuming that is it there the first run, I do not see you rewriting it, so it can be deleted again. I...
Leon79 General Coding Help 4 2,915 Jul-13-2020, 06:35 PM
    Thread: delete a file works but with error
Post: delete a file works but with error

Hello, I get an error from my code, I create the path in order to delete the correct file (I have import os of course), even if my code delete the correct file, in the terminal I get the following er...
Leon79 General Coding Help 4 2,915 Jul-13-2020, 05:30 PM
    Thread: form select option tags, add "selected" on <option> in python at a condition
Post: RE: form select option tags, add "selected" on <op...

I could make it in the following way, but I know that this is the longest solution, for sure there is a better way, but as a student it's ok. If anybody has a better idea, please share it thank you. ...
Leon79 Homework 3 2,620 Jul-12-2020, 02:56 PM
    Thread: form select option tags, add "selected" on <option> in python at a condition
Post: form select option tags, add "selected" on <option...

Hello Coders, I'm still working on my project for the course, and I'm not giving up, even if everything looks to slow me down! I'm at the point where I'm building the page edit_recipe.html to edit a...
Leon79 Homework 3 2,620 Jul-12-2020, 12:32 PM
    Thread: redirect url_for passing arguments with the url
Post: RE: redirect url_for passing arguments with the ur...

Solved: takeid = str(dict1["_id"]) return redirect(url_for('recipe', recipe_id=takeid))
Leon79 General Coding Help 1 1,637 Jul-09-2020, 05:20 PM
    Thread: redirect url_for passing arguments with the url
Post: redirect url_for passing arguments with the url

Hello Coders! I have a problem with a redirect, I'm a very beginner, and I would like to accomplish to this! I show you the code: # This is the Object ID myMongoDB_id = str(dict1["_id"]) return r...
Leon79 General Coding Help 1 1,637 Jul-08-2020, 08:05 PM
    Thread: find file not knowing the extension
Post: RE: find file not knowing the extension

It's not working, I tried any kind of code, because it's not hard to solve. The problem is with Jinja, I'm missing something. I have also tried the following: <div id="recipe-cont-body...
Leon79 General Coding Help 6 3,064 Jul-07-2020, 04:44 PM
    Thread: find file not knowing the extension
Post: RE: find file not knowing the extension

(Jul-07-2020, 12:47 PM)DeaD_EyE Wrote: You could use this module form the standard lib: https://docs.python.org/2/library/imghdr.html Thank you but it looks that I already need to know the extension...
Leon79 General Coding Help 6 3,064 Jul-07-2020, 12:56 PM
    Thread: find file not knowing the extension
Post: find file not knowing the extension

Hello Coders! I'm a student and I'm trying to complete a project for my course. I'm creating a small blog and now I'm working on the recipe page. The project is in Python+Flask+MongoDB. I could do a...
Leon79 General Coding Help 6 3,064 Jul-07-2020, 12:06 PM
    Thread: insert more data at once in MongoDB
Post: RE: insert more data at once in MongoDB

Thank you very much, I solved adding a value to the dictionary: dict1 = request.form.to_dict() dict1['posted'] = posted recipes.insert_one(dict1)Now I just need to understand how to get ...
Leon79 General Coding Help 2 2,332 Jul-05-2020, 01:34 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020