|
Yeah, that's fair. As an aside, we pretty much ALWAYS make page sections full width for this reason. If we want to maintain some sort of Grid measure we maintain a Measure Component that handles setting max-width, centering, etc. We did such on this site: https://archierose.com.au/ code:
|
# ? Feb 28, 2017 21:26 |
|
|
# ? May 9, 2024 17:29 |
|
Head up WordPressers, NextGEN gallery plugin (over a million installs) has an SQL injection exploit.
|
# ? Mar 1, 2017 02:50 |
|
Scaramouche posted:Head up WordPressers, NextGEN gallery plugin (over a million installs) has an SQL injection exploit. Okay, so much for my "only trusted plugins" motto.
|
# ? Mar 1, 2017 03:50 |
|
Scaramouche posted:Head up WordPressers, NextGEN gallery plugin (over a million installs) has an SQL injection exploit. Goddamn do i hate NextGEN, looking forward to gloating about this to my buddy who insists it's good.
|
# ? Mar 1, 2017 10:40 |
|
PT6A posted:Drupal is slightly more powerful than WordPress but still pretty awful to work with. Do you need to know Python to work with it? Can you give some examples of how it works as a CMS?
|
# ? Mar 1, 2017 21:25 |
|
Grump posted:Do you need to know Python to work with it? Yes. Grump posted:Can you give some examples of how it works as a CMS? Django is more flexible than Wordpress or whatever CMS by virtue of the fact that its not a CMS...it's a tool to build a CMS (or anything really).
|
# ? Mar 1, 2017 22:18 |
|
Grump posted:Do you need to know Python to work with it? There are a few "big" CMS written in Django if you want to check them out / see what's possible: https://www.django-cms.org/en/ https://wagtail.io/ I have never used either, so I am not recommending them, I just know they exists.
|
# ? Mar 1, 2017 22:31 |
|
Thermopyle posted:Yes. Well poo poo
|
# ? Mar 1, 2017 23:03 |
|
If you know PHP there's always Laravel and pretty much every major higher level language has an MVC web framework like Django.
|
# ? Mar 1, 2017 23:10 |
|
Gmaz posted:If you know PHP there's always Laravel and pretty much every major higher level language has an MVC web framework like Django. I've worked with a few PHP-based frameworks now, and I really like Django by comparison. The auth/admin system is way more flexible out of the box than other MVC systems I've worked with, and while it's not a complete CMS out of the box, I don't find it particularly more challenging to get it to a usable point than I would writing, say, a WordPress theme, because you don't have to make as many concessions to how the system wants you to do things. If you're going to build a pure blog, you're probably better off sticking with a more typical CMS (WordPress really isn't bad if all you want is a blog).
|
# ? Mar 2, 2017 01:28 |
|
Anyone care to attempt to sum up restful api in like 2 to 3 sentences? Since I'm self taught I don't know what it is by name but I imagine I've worked with it before. All the definitions I'm finding on the internet are quite extensive.
|
# ? Mar 3, 2017 00:29 |
|
huhu posted:Anyone care to attempt to sum up restful api in like 2 to 3 sentences? Since I'm self taught I don't know what it is by name but I imagine I've worked with it before. All the definitions I'm finding on the internet are quite extensive. A RESTful API is a theoretical thing that nobody uses in practice as described because once the first requirement change comes in all the crap that would make it actually RESTful gets trashed.
|
# ? Mar 3, 2017 00:40 |
Parameterized URLs that directly map to database models, with CRUD operations controlled by appropriate HTTP methods, like GET for read, DELETE for delete, ... And here's where it gets funky, because do you use POST or PUT to create or update? Are they interchangeable? And what about systems where there is more than one kind of update operation, like one that updates attributes on the object directly and another that creates a child object or a task based on it? And does your client framework actually properly support all those seldom-used methods? Upshot: I find REST to be a nice idea but an oversimplified model for most real-world applications. Turns out even google's apis tell you to just use POST for operations that should be GETs because fuckit.
|
|
# ? Mar 3, 2017 00:42 |
|
Data Graham posted:Turns out even google's apis tell you to just use POST for operations that should be GETs because fuckit. Which is all well and good until someone flags your PR for using POST when technically your operation is idempotent so perhaps maybe PUT is the better 'fuckit' verb and everyone wastes their time in code review debating which verb is the best to describe your not-exactly-restful request. I guess what I'm saying is that there should be an actual FUCK_IT method.
|
# ? Mar 3, 2017 00:49 |
|
The important thing about REST is delivering you from managing client state in your server.
|
# ? Mar 3, 2017 01:06 |
|
Data Graham posted:Parameterized URLs that directly map to business objects, with CRUD operations controlled by appropriate HTTP methods, like GET for read, DELETE for delete, ... FTFY. Exposing DB structure on an API just makes it hard as hell to change anything ever.
|
# ? Mar 3, 2017 15:11 |
Munkeymon posted:FTFY. Exposing DB structure on an API just makes it hard as hell to change anything ever. Yeah, I hemmed/hawed over that, but thought the goal was to be as "what you're actually likely to use the concept for" as possible. This is the kind of thing that makes it hard to read the Wikipedia article and easier to come here to ask wtf REST is instead.
|
|
# ? Mar 3, 2017 15:17 |
|
ROFLburger posted:I guess what I'm saying is that there should be an actual FUCK_IT method. I thought that's what POST was...
|
# ? Mar 3, 2017 17:30 |
|
Hey dudes. Speaking of POST, how can I send data via POST from javascript to a server (ie Django), without using AJAX? Most search results about javascript or jquery and POST are about AJAX - but I don't want AJAX (I think), since I'm trying to update the web page after sending the request, which AJAX appears not to do.
|
# ? Mar 3, 2017 18:13 |
|
Dominoes posted:Hey dudes. Speaking of POST, how can I send data via POST from javascript to a server (ie Django), without using AJAX? Most search results about javascript or jquery and POST are about AJAX - but I don't want AJAX (I think), since I'm trying to update the web page after sending the request, which AJAX appears not to do. You can either use a callback on the AJAX method the reloads the page (document.location.reload() if I'm not mistaken), or you could use the submit() method on a form that contains the data you want to submit.
|
# ? Mar 3, 2017 18:24 |
I mentioned this in the other thread but was phoneposting, so here's a more explicit example.code:
|
|
# ? Mar 3, 2017 19:55 |
|
PT6A posted:You can either use a callback on the AJAX method the reloads the page (document.location.reload() if I'm not mistaken), or you could use the submit() method on a form that contains the data you want to submit. Data Graham posted:I mentioned this in the other thread but was phoneposting, so here's a more explicit example.
|
# ? Mar 3, 2017 20:09 |
|
Dominoes posted:Hey, saw and tried your post. Sorry about not getting back to you on it! Correct; not working. Server gets data and can run code on it, but page doesn't update. We don't know what other thread you're talking about, so maybe post more context here so people can try to help you. It is possible that your server isn't sending a response (or is sending an error code), which would lead to that success function never getting called.
|
# ? Mar 3, 2017 20:34 |
|
camoseven posted:We don't know what other thread you're talking about, so maybe post more context here so people can try to help you. It is possible that your server isn't sending a response (or is sending an error code), which would lead to that success function never getting called. Or even better, don't post the same question in different threads simultaneously! That way people don't miss out on context and people don't spent time answers something you may have gotten solved 5 minutes ago in "the other thread"
|
# ? Mar 3, 2017 20:37 |
|
Lumpy posted:Or even better, don't post the same question in different threads simultaneously! That way people don't miss out on context and people don't spent time answers something you may have gotten solved 5 minutes ago in "the other thread" And people don't end up replying with a summary of what someone posted in the other thread in response to the same question because they didn't realize it was the same poster asking the original question in both cases (what I just did -- full credit for the solution goes to Data Graham).
|
# ? Mar 3, 2017 20:51 |
|
Dominoes posted:Hey, saw and tried your post. Sorry about not getting back to you on it! Correct; not working. Server gets data and can run code on it, but page doesn't update. I've never really wanted to do what I think you're wanting to do, but if you want the same behavior as you'd get as if it was just a regular form the user was clicking the submit button on, you can just create a form and "click" the submit button with JS. You can even create the form with JS and make it hidden so the user has no idea what you're doing behind the scenes. edit: I googled "javascript POST form data" and came up with this: http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit Is that what you're wanting?
|
# ? Mar 3, 2017 20:57 |
|
You're right; I posted it in the Django thread recently. Not much more context; just looking for a way to send post data to a server, and have it update the page. Simplified server code explaining the issue; A viewer opens the page, sees 5 rendered in the template. Does something on the page triggering the POST call; server in JS. The server correctly identifies the var change, but 5 is still displayed when I'd like 6. ie: Python code:
Dominoes fucked around with this message at 21:16 on Mar 3, 2017 |
# ? Mar 3, 2017 20:59 |
If you're using AJAX to send the POST, you probably don't want the server to return you another fully rendered full-page template. You want it to send an HTML fragment which you can inject into a structural element in the page, requiring no reloading. (That's kind of the main point of AJAX.) Or else, more elegantly, you can have it send you some simplified structured data (i.e. JSON), which your AJAX call can then easily interpret and do whatever you want, whether it's to reload the entire page (kind of brute force but gets the job done), or to simply rewrite a piece of the HTML with pure JavaScript. I can write up some examples once I'm off phone.
|
|
# ? Mar 4, 2017 00:19 |
|
Data Graham posted:If you're using AJAX to send the POST, you probably don't want the server to return you another fully rendered full-page template. You want it to send an HTML fragment which you can inject into a structural element in the page, requiring no reloading. (That's kind of the main point of AJAX.) Or else, more elegantly, you can have it send you some simplified structured data (i.e. JSON), which your AJAX call can then easily interpret and do whatever you want, whether it's to reload the entire page (kind of brute force but gets the job done), or to simply rewrite a piece of the HTML with pure JavaScript. He doesn't want AJAX. Or at least thats what he says, but it may be an XY problem.
|
# ? Mar 4, 2017 01:00 |
|
IDK what I'm doing, just want to render the form with the new data. In one case, I got around it by modifying the page with Jquery to look like how it would with a refresh (after a DB update). In others, this would get complicated. Normal POST requests, like with forms, work as expected. However, I'm using things that aren't forms. AJAX requests somehow bypass the normal MVC process. ? Therm - I think your solution should work, but I'm still working on the CSRF validation. Dominoes fucked around with this message at 01:07 on Mar 4, 2017 |
# ? Mar 4, 2017 01:03 |
|
Dominoes posted:IDK what I'm doing, just want to render the form with the new data. In one case, I got around it by modifying the page with Jquery to look like how it would with a refresh (after a DB update). In others, I need to fully refresh the page to show DB changes. You can just have your view return an HTML snippet to an AJAX request, and then use javascript/jquery to insert that HTML snippet into the page. Page never refreshes, but it updates with new information. This is the best way if you're using js anyway. Dominoes posted:Therm - I think your solution should work, but I'm still working on the CSRF validation. You have to put the CSRF token in the page somewhere. You can even dump it right in your script in the template. like if you're doing AJAX: code:
Thermopyle fucked around with this message at 01:09 on Mar 4, 2017 |
# ? Mar 4, 2017 01:07 |
|
I'm reading a (the) Flask tutorial and it talks about setting up a login form with OpenID. I have a system that I'd like to let ~5 people login to view some data and lock it from others. Is OpenID the easiest way to go for this? What other common method(s) exist?
|
# ? Mar 4, 2017 01:27 |
|
huhu posted:I'm reading a (the) Flask tutorial and it talks about setting up a login form with OpenID. I have a system that I'd like to let ~5 people login to view some data and lock it from others. Is OpenID the easiest way to go for this? What other common method(s) exist? For 5 people just use whatever Flask's default auth mechanism is with user/pass.
|
# ? Mar 4, 2017 01:30 |
Dominoes posted:IDK what I'm doing, just want to render the form with the new data. In one case, I got around it by modifying the page with Jquery to look like how it would with a refresh (after a DB update). In others, this would get complicated. Yes, you can think of AJAX as a way to bypass the MVC structure, in that its whole purpose is that it allows you to break free of the "load a page, submit a form, load a whole resulting page" progression and create a more seamless, "desktop app" -like user experience. Basically it means you can repaint just certain parts of your page instead of loading a whole new page every time you do something. This is what people mean by a "single page app". Here's how I would do this: On the Django side, instead of returning an HTML page, return a bit of JSON: code:
code:
But yeah, it's still not totally clear why AJAX is even involved here. It sounds like you just have a regular form you want to submit the traditional full-page way, and the whole single-page experience thing isn't really your goal. What's preventing you from doing that? Do you have to manipulate the form data on the client side before you submit it? Because that can be done without AJAX: code:
|
|
# ? Mar 4, 2017 04:05 |
|
Here's a really silly problem. I feel like I almost have it, but it is 2AM and my brain is no longer working. I want: - To have a box of a flexible horizontal size, up a maximum. - With borders. - Within the box I want to have: -- Some preformatted text. -- Which is zebra striped. -- Which has line numbers. -- Which can be longer than the maximum allowed horizontal space in the box, making the box get a scrollbar when this happens, but only when required. I actually have accomplished everything in CSS, except one ugly thing. When I scroll the box, the background slides to the left, leaving me with text on a white background. I'd fake it somehow, but that clashes with the zebra striping. I can post a sample of my problem tomorrow, but I have hacked things up to bits so much that I don't think it would be helpful. I think a start from scratch would be a good way about it. Any ideas? No Gravitas fucked around with this message at 11:35 on Mar 4, 2017 |
# ? Mar 4, 2017 11:09 |
No Gravitas posted:Here's a really silly problem. I feel like I almost have it, but it is 2AM and my brain is no longer working. How are you doing the zebra striping? What's your CSS for it?
|
|
# ? Mar 4, 2017 12:32 |
|
Data Graham posted:How are you doing the zebra striping? What's your CSS for it? Here's an approximation of what I was doing, stripped of all the irrelevant detail. https://jsfiddle.net/zjLqe1ph/ I have no idea what I'm doing, so it is likely really messed up. Scroll to the right to see the background slide away to the left.
|
# ? Mar 4, 2017 19:56 |
|
Data, Therm, Thanks a lot for the help with Django/POST! Thermopyle posted:You can just have your view return an HTML snippet to an AJAX request, and then use javascript/jquery to insert that HTML snippet into the page. Page never refreshes, but it updates with new information. This is the best way if you're using js anyway. quote:You have to put the CSRF token in the page somewhere. You can even dump it right in your script in the template. like if you're doing AJAX: Data Graham posted:Yes, you can think of AJAX as a way to bypass the MVC structure, in that its whole purpose is that it allows you to break free of the "load a page, submit a form, load a whole resulting page" progression and create a more seamless, "desktop app" -like user experience. Basically it means you can repaint just certain parts of your page instead of loading a whole new page every time you do something. This is what people mean by a "single page app". quote:But yeah, it's still not totally clear why AJAX is even involved here. It sounds like you just have a regular form you want to submit the traditional full-page way, and the whole single-page experience thing isn't really your goal. What's preventing you from doing that? Do you have to manipulate the form data on the client side before you submit it? Because that can be done without AJAX: Throughout this, I'm impressed by how versatile JQuery is. Dominoes fucked around with this message at 22:48 on Mar 4, 2017 |
# ? Mar 4, 2017 22:43 |
Dominoes posted:Sick; going to give that a shot. For now, I turned the form in question into a Django form, added a submit button, and let it do its thing there. Another thing I noticed by accident: If a button's type is left unspecified, it defaults to 'submit', so even the button actually triggers an AJAX call, the page will refresh. Seems hacky though; I like your approach better. Yeah, that's a common gotcha. You can either set the button's type to "button" to prevent the default submit behavior, or another way is to put a preventDefault() on the click event. Data Graham fucked around with this message at 00:15 on Mar 5, 2017 |
|
# ? Mar 5, 2017 00:11 |
|
|
# ? May 9, 2024 17:29 |
No Gravitas posted:Here's an approximation of what I was doing, stripped of all the irrelevant detail. Try this: code:
|
|
# ? Mar 5, 2017 00:23 |