Opinion needed for a BookMarker project - Regarding CSRF token
I am new to Django and am learning it baically because I wanted to create a BookMarker project. A project for managing bookmarks. For this I am going to create a UI through Django and a JavaScript for sending the URLs to the app. There is a problem of CSRF token in Django. I was able to do a dummy POST request by sending the CSRF token hard-coded as a parameter. But I do not understand how the CSRF tokens are generated. Can I just hard-code them? I don't think that it should be possible otherwise there is no point of having it in the first place. Should I consider turning off the CSRF middleware as this is just local machine or should I keep it as a best practice and find a way to generate the CSRF token in my JavaScript? That would suck but I am out of opinions. Also when you are doing Django projects and need to deal with JS then what do you do? I mean is there an alternative for JS in Django? If any of these questions doesn't make any sense please tell and I will try to improve these. Just tell what doesn't make sense. -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8f166450-195f-45fb-98e5-c67448ed92b5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Opinion needed for a BookMarker project - Regarding CSRF token
Hi Sanjay I think you misunderstood a bit. The JS that I am talking about will not be inside the web pages of the project. The JS is supposed to be used as a Bookmarklet in the web browser. I intend to use the bookmarklet for sending the current webpage's url to the app via a POST request. The app will then store the URL. Here a problem due to CSRF token would occur becuase I can hard-code the CSRF token in the JS for one environment but as I am not aware how the token is generated it would be difficult to dynamically generate the token in the JS for a different environment. For example if I tried to run the app on a different computer than I will have to manually check the CSRF token for that and change the hard-coding. On Tuesday, May 13, 2014 12:57:40 AM UTC+5:30, Sanjay Bhangar wrote: > > Hi Aseem, > > On Mon, May 12, 2014 at 11:25 PM, Aseem Bansal > > > wrote: > > I am new to Django and am learning it baically because I wanted to > create a > > BookMarker project. A project for managing bookmarks. For this I am > going to > > create a UI through Django and a JavaScript for sending the URLs to the > app. > > There is a problem of CSRF token in Django. I was able to do a dummy > POST > > request by sending the CSRF token hard-coded as a parameter. But I do > not > > understand how the CSRF tokens are generated. Can I just hard-code them? > I > > don't think that it should be possible otherwise there is no point of > having > > it in the first place. Should I consider turning off the CSRF middleware > as > > this is just local machine or should I keep it as a best practice and > find a > > way to generate the CSRF token in my JavaScript? That would suck but I > am > > out of opinions. > > > > To use the csrf token and send it along with AJAX requests made in > javascript, refer > https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax . > > It should be fairly straightforward following steps there. Let know if > anything is unclear or does not work. > > > Also when you are doing Django projects and need to deal with JS then > what > > do you do? I mean is there an alternative for JS in Django? > > > > If any of these questions doesn't make any sense please tell and I will > try > > to improve these. Just tell what doesn't make sense. > > > > Hope the documentation makes sense, otherwise just search for "django > ajax csrf token" or so and you should find quite a lot of examples > online :) > > All the best. > -Sanjay > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/971c8426-16a7-4fb3-8d5c-36b8d8d9b1a2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Opinion needed for a BookMarker project - Regarding CSRF token
I understand that it would leave the view open to CSRF attack. That is the reason why I asked about "Also when you are doing Django projects and need to deal with JS then what do you do? I mean is there an alternative for JS in Django? ". I mean that whether there is a way to properly integrate JS with Django? On Tuesday, May 13, 2014 1:44:08 AM UTC+5:30, Tom Evans wrote: > > On Mon, May 12, 2014 at 9:08 PM, Tom Evans > > > wrote: > > On Mon, May 12, 2014 at 9:01 PM, Aseem Bansal > > > > wrote: > >> Hi Sanjay > >> > >> I think you misunderstood a bit. The JS that I am talking about will > not be > >> inside the web pages of the project. The JS is supposed to be used as a > >> Bookmarklet in the web browser. I intend to use the bookmarklet for > sending > >> the current webpage's url to the app via a POST request. The app will > then > >> store the URL. > > > > The entire purpose of CSRF is to stop things like that from being > > possible. The bookmark makes a cross site request from the site you > > are currently on to your django site. > > > > In light of that, disable CSRF for that view. > > > > I should also mention that this would also leave that view wide open > to a CSRF attack. A malicious user who can make you execute javascript > - if you view a webpage they either control, or have injected > javascript in to (like a forum) - could then make your browser make > forged requests to your view, submitting whatever content or url that > they wanted to it, using your credentials. > > Cheers > > Tom > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/398a7bf4-61d7-40a9-b98a-0d68ebe6fa11%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Opinion needed for a BookMarker project - Regarding CSRF token
Also couldn't it be like a webservice? I mean in Django I create a view which would require some authentication and the JS can ask for passwords? Is there something I am completely missing in here? Just floating an idea becuase turning off security doesn't seem like a good design. The options left is either make a authentication myself for JS and Django to use same tokens or somehow make the website realize that the JS is a bookmarklet. The second option doesn't seem probable because JavaScript from any website will be downloaded on local computer and so will be the bookmarklet. Hard to distinguish that way. On Tuesday, May 13, 2014 10:44:02 PM UTC+5:30, Aseem Bansal wrote: > > I understand that it would leave the view open to CSRF attack. That is the > reason why I asked about "Also when you are doing Django projects and need > to deal with JS then what do you do? I mean is there an alternative for JS > in Django? ". I mean that whether there is a way to properly integrate JS > with Django? > > On Tuesday, May 13, 2014 1:44:08 AM UTC+5:30, Tom Evans wrote: >> >> On Mon, May 12, 2014 at 9:08 PM, Tom Evans >> wrote: >> > On Mon, May 12, 2014 at 9:01 PM, Aseem Bansal >> wrote: >> >> Hi Sanjay >> >> >> >> I think you misunderstood a bit. The JS that I am talking about will >> not be >> >> inside the web pages of the project. The JS is supposed to be used as >> a >> >> Bookmarklet in the web browser. I intend to use the bookmarklet for >> sending >> >> the current webpage's url to the app via a POST request. The app will >> then >> >> store the URL. >> > >> > The entire purpose of CSRF is to stop things like that from being >> > possible. The bookmark makes a cross site request from the site you >> > are currently on to your django site. >> > >> > In light of that, disable CSRF for that view. >> > >> >> I should also mention that this would also leave that view wide open >> to a CSRF attack. A malicious user who can make you execute javascript >> - if you view a webpage they either control, or have injected >> javascript in to (like a forum) - could then make your browser make >> forged requests to your view, submitting whatever content or url that >> they wanted to it, using your credentials. >> >> Cheers >> >> Tom >> > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9297b8db-14df-4d4c-a5b1-b1f3e905f60d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Opinion needed for a BookMarker project - Regarding CSRF token
Thanks for the explanation Tom. Really appreciate that. Your explanation is very clear. My question's focus is not. From the beginning I have focused on CSRF which might have taken the focus away from the real problem at hand. The problem is that data needs to be passed from the browser's current tab to a particular URL. The data being the current URL. Other things like JavaScript and using POST are not part of the actual problem statement. It is just one implementation idea that I think can work. The problem left is that I need a way to authenticate as well. As authentication is handled through CSRF middleware hence my focus was there. The lack of clarity was in my understanding that a JS used a bookmarklet effectively becomes a JS on that particular website. The integration that I was talking about is some authentication framework which can work with both Django and JS to make this possible. Any libraries? I am at a loss of keywords to look for the libraries. I understand that it is still a question without concrete requirements but please share if any ideas or if I simply need to work it out myself. Am I looking at the problem from the incorrect prospective? I mean should I try to look at the browser extensions for this functionality? Try to create one myself? On Tuesday, May 13, 2014 10:54:25 PM UTC+5:30, Tom Evans wrote: > > On Tue, May 13, 2014 at 6:14 PM, Aseem Bansal > > > wrote: > > I understand that it would leave the view open to CSRF attack. That is > the > > reason why I asked about "Also when you are doing Django projects and > need > > to deal with JS then what do you do? I mean is there an alternative for > JS > > in Django? ". I mean that whether there is a way to properly integrate > JS > > with Django? > > In what way is it integrated "improperly" currently? Django is a > library which outputs text, normally HTML. What you put in the text is > up to you. > > CSRF is designed to stop requests like the ones you are trying to > make. There is no protection that can allow requests like yours, and > disallow the naughty ones, because the naughty ones look just like the > allowed ones. > > This is the purpose of the CSRF token, it prevents requests that are > like form submissions from being submitted to the site unless the data > was submitted from a page loaded by the site, which would supply a > CSRF token. This token protects you from CSRF attacks, it guarantees > that submissions are not forged. > > Now, you want to make submissions to your site from pages not loaded > from the site, making it impossible to have a CSRF token provided, and > so it cannot provide this guarantee. > Therefore, there cannot be CSRF protection that allows those > submissions and prevents forged ones. > > I can't make it much clearer than that I'm afraid - if it still isn't > clear someone else will need to step in. > > Cheers > > Tom > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7f0c5726-8b72-49b4-91be-4b7a9b9e091a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
BookMarker Project - Opening local files on localhost through Django generated pages
I am working on a BookMarker project for managing my bookmarks. I was creating the search page for lisitng bookmarks as per categories. I hit a snag while testing it. I am unable to open locally stored webpages. I understand that it is for security purposes but is it possible (cross-browser way) to grant permissions for a app to open locally stored files? The app can ask for permissions for 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f6aec47e-8dd9-42c5-a9bd-9f7e32395787%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: BookMarker Project - Opening local files on localhost through Django generated pages
I am running with DEBUG=TRUE so far On Wednesday, May 21, 2014 12:10:02 AM UTC+5:30, Adam wrote: > > On Tue, 2014-05-20 at 11:29 -0700, Aseem Bansal wrote: > > I am working on a BookMarker project for managing my bookmarks. I was > creating the search page for lisitng bookmarks as per categories. I hit a > snag while testing it. I am unable to open locally stored webpages. I > understand that it is for security purposes but is it possible > (cross-browser way) to grant permissions for a app to open locally stored > files? The app can ask for permissions for this. > > > Are you running with DEBUG=True or did you set ALLOWED_HOSTS? > > > -- > Adam (ad...@csh.rit.edu ) > > > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f2ff621a-d6b4-4900-85a4-95b3a3d369cb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: BookMarker Project - Opening local files on localhost through Django generated pages
I want the the webpage served to the client machine from the server to have a hyperlink. The hyperlink will be for a html file stored on the client machine. After the webpage has been served to the client webbrowser then when the client user clicks on the hyperlink I want the html page to be opened in the webbrowser. The webbrowser can ask for the permissions if necessary. Basically I want a interface where I can manage my bookmarks - offline or online for which I am making this. So any ideas now? On Thursday, May 22, 2014 1:45:53 PM UTC+5:30, Daniel Roseman wrote: > > On Tuesday, 20 May 2014 19:29:06 UTC+1, Aseem Bansal wrote: >> >> I am working on a BookMarker project for managing my bookmarks. I was >> creating the search page for lisitng bookmarks as per categories. I hit a >> snag while testing it. I am unable to open locally stored webpages. I >> understand that it is for security purposes but is it possible >> (cross-browser way) to grant permissions for a app to open locally stored >> files? The app can ask for permissions for this. >> > > You'll need to be a bit clearer. Ignoring for the moment the fact that the > client and the server are the same machine in development, are you hoping > for your server to be able to open pages stored locally on your client? > That's not going to be possible, for what I hope are obvious reasons. If > that's not what you mean, you should explain in more detail. > -- > DR. > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8c657e56-c66a-4443-a7fb-a69cd11a55b4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: BookMarker Project - Opening local files on localhost through Django generated pages
The server will not be able to open pages stored on client machine but the client user should be able to open html pages stored on client machine by clicking on a hyperlink manually. On Thursday, May 22, 2014 10:02:52 PM UTC+5:30, Aseem Bansal wrote: > > I want the the webpage served to the client machine from the server to > have a hyperlink. The hyperlink will be for a html file stored on the > client machine. After the webpage has been served to the client webbrowser > then when the client user clicks on the hyperlink I want the html page to > be opened in the webbrowser. The webbrowser can ask for the permissions if > necessary. > > Basically I want a interface where I can manage my bookmarks - offline or > online for which I am making this. So any ideas now? > > On Thursday, May 22, 2014 1:45:53 PM UTC+5:30, Daniel Roseman wrote: >> >> On Tuesday, 20 May 2014 19:29:06 UTC+1, Aseem Bansal wrote: >>> >>> I am working on a BookMarker project for managing my bookmarks. I was >>> creating the search page for lisitng bookmarks as per categories. I hit a >>> snag while testing it. I am unable to open locally stored webpages. I >>> understand that it is for security purposes but is it possible >>> (cross-browser way) to grant permissions for a app to open locally stored >>> files? The app can ask for permissions for this. >>> >> >> You'll need to be a bit clearer. Ignoring for the moment the fact that >> the client and the server are the same machine in development, are you >> hoping for your server to be able to open pages stored locally on your >> client? That's not going to be possible, for what I hope are obvious >> reasons. If that's not what you mean, you should explain in more detail. >> -- >> DR. >> > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7df2d6a2-dcc9-4551-8617-a4eb30003926%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: BookMarker Project - Opening local files on localhost through Django generated pages
I understand the requirement of file protocol. That's how I keep bookmarks in Chrome currently. But when I served the same as a hyperlink I am getting Not allowed to load local resource: On Thursday, May 22, 2014 10:14:39 PM UTC+5:30, François Schiettecatte wrote: > > You can do this with a 'file://...' url, that will cause the browser to > open a file on the local file system, the browser won't need to ask for > permission, the only issue is that the files will need to be in a known > path. > > François > > On May 22, 2014, at 12:34 PM, Aseem Bansal > > wrote: > > > The server will not be able to open pages stored on client machine but > the client user should be able to open html pages stored on client machine > by clicking on a hyperlink manually. > > > > On Thursday, May 22, 2014 10:02:52 PM UTC+5:30, Aseem Bansal wrote: > > I want the the webpage served to the client machine from the server to > have a hyperlink. The hyperlink will be for a html file stored on the > client machine. After the webpage has been served to the client webbrowser > then when the client user clicks on the hyperlink I want the html page to > be opened in the webbrowser. The webbrowser can ask for the permissions if > necessary. > > > > Basically I want a interface where I can manage my bookmarks - offline > or online for which I am making this. So any ideas now? > > > > On Thursday, May 22, 2014 1:45:53 PM UTC+5:30, Daniel Roseman wrote: > > On Tuesday, 20 May 2014 19:29:06 UTC+1, Aseem Bansal wrote: > > I am working on a BookMarker project for managing my bookmarks. I was > creating the search page for lisitng bookmarks as per categories. I hit a > snag while testing it. I am unable to open locally stored webpages. I > understand that it is for security purposes but is it possible > (cross-browser way) to grant permissions for a app to open locally stored > files? The app can ask for permissions for this. > > > > You'll need to be a bit clearer. Ignoring for the moment the fact that > the client and the server are the same machine in development, are you > hoping for your server to be able to open pages stored locally on your > client? That's not going to be possible, for what I hope are obvious > reasons. If that's not what you mean, you should explain in more detail. > > -- > > DR. > > > > -- > > 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 post to this group, send email to > > django...@googlegroups.com. > > > Visit this group at http://groups.google.com/group/django-users. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/7df2d6a2-dcc9-4551-8617-a4eb30003926%40googlegroups.com. > > > > For more options, visit https://groups.google.com/d/optout. > > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ae6cc50e-1adb-4e05-abcd-2e716bb8f778%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: BookMarker Project - Opening local files on localhost through Django generated pages
Here is the code so far. I have just kept Bootstrap and JQuery ignored in git. Rest is there https://github.com/anshbansal/Bookmarker On Thursday, May 22, 2014 11:09:09 PM UTC+5:30, C. Kirby wrote: > > Errors without code aren't very useful. If you provide the view and > template you are rendering it will give us something to latch onto and debug > > Kirby > > On Thursday, May 22, 2014 12:23:06 PM UTC-5, Aseem Bansal wrote: >> >> I understand the requirement of file protocol. That's how I keep >> bookmarks in Chrome currently. But when I served the same as a hyperlink I >> am getting Not allowed to load local resource: >> >> On Thursday, May 22, 2014 10:14:39 PM UTC+5:30, François Schiettecatte >> wrote: >>> >>> You can do this with a 'file://...' url, that will cause the browser to >>> open a file on the local file system, the browser won't need to ask for >>> permission, the only issue is that the files will need to be in a known >>> path. >>> >>> François >>> >>> On May 22, 2014, at 12:34 PM, Aseem Bansal wrote: >>> >>> > The server will not be able to open pages stored on client machine but >>> the client user should be able to open html pages stored on client machine >>> by clicking on a hyperlink manually. >>> > >>> > On Thursday, May 22, 2014 10:02:52 PM UTC+5:30, Aseem Bansal wrote: >>> > I want the the webpage served to the client machine from the server to >>> have a hyperlink. The hyperlink will be for a html file stored on the >>> client machine. After the webpage has been served to the client webbrowser >>> then when the client user clicks on the hyperlink I want the html page to >>> be opened in the webbrowser. The webbrowser can ask for the permissions if >>> necessary. >>> > >>> > Basically I want a interface where I can manage my bookmarks - offline >>> or online for which I am making this. So any ideas now? >>> > >>> > On Thursday, May 22, 2014 1:45:53 PM UTC+5:30, Daniel Roseman wrote: >>> > On Tuesday, 20 May 2014 19:29:06 UTC+1, Aseem Bansal wrote: >>> > I am working on a BookMarker project for managing my bookmarks. I was >>> creating the search page for lisitng bookmarks as per categories. I hit a >>> snag while testing it. I am unable to open locally stored webpages. I >>> understand that it is for security purposes but is it possible >>> (cross-browser way) to grant permissions for a app to open locally stored >>> files? The app can ask for permissions for this. >>> > >>> > You'll need to be a bit clearer. Ignoring for the moment the fact that >>> the client and the server are the same machine in development, are you >>> hoping for your server to be able to open pages stored locally on your >>> client? That's not going to be possible, for what I hope are obvious >>> reasons. If that's not what you mean, you should explain in more detail. >>> > -- >>> > DR. >>> > >>> > -- >>> > 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 post to this group, send email to django...@googlegroups.com. >>> > Visit this group at http://groups.google.com/group/django-users. >>> > To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/7df2d6a2-dcc9-4551-8617-a4eb30003926%40googlegroups.com. >>> >>> >>> > For more options, visit https://groups.google.com/d/optout. >>> >>> -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/154500bf-581a-4069-8eed-72e2ab511198%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: BookMarker Project - Opening local files on localhost through Django generated pages
The error is coming in Chrome's console not in Python/Django when I try to click on the link in my webbrowser. The HTML generated is below Python 3.4 Docs On Thursday, May 22, 2014 11:30:31 PM UTC+5:30, Aseem Bansal wrote: > > Here is the code so far. I have just kept Bootstrap and JQuery ignored in > git. Rest is there > > https://github.com/anshbansal/Bookmarker > > On Thursday, May 22, 2014 11:09:09 PM UTC+5:30, C. Kirby wrote: >> >> Errors without code aren't very useful. If you provide the view and >> template you are rendering it will give us something to latch onto and debug >> >> Kirby >> >> On Thursday, May 22, 2014 12:23:06 PM UTC-5, Aseem Bansal wrote: >>> >>> I understand the requirement of file protocol. That's how I keep >>> bookmarks in Chrome currently. But when I served the same as a hyperlink I >>> am getting Not allowed to load local resource: >>> >>> On Thursday, May 22, 2014 10:14:39 PM UTC+5:30, François Schiettecatte >>> wrote: >>>> >>>> You can do this with a 'file://...' url, that will cause the browser to >>>> open a file on the local file system, the browser won't need to ask for >>>> permission, the only issue is that the files will need to be in a known >>>> path. >>>> >>>> François >>>> >>>> On May 22, 2014, at 12:34 PM, Aseem Bansal wrote: >>>> >>>> > The server will not be able to open pages stored on client machine >>>> but the client user should be able to open html pages stored on client >>>> machine by clicking on a hyperlink manually. >>>> > >>>> > On Thursday, May 22, 2014 10:02:52 PM UTC+5:30, Aseem Bansal wrote: >>>> > I want the the webpage served to the client machine from the server >>>> to have a hyperlink. The hyperlink will be for a html file stored on the >>>> client machine. After the webpage has been served to the client webbrowser >>>> then when the client user clicks on the hyperlink I want the html page to >>>> be opened in the webbrowser. The webbrowser can ask for the permissions if >>>> necessary. >>>> > >>>> > Basically I want a interface where I can manage my bookmarks - >>>> offline or online for which I am making this. So any ideas now? >>>> > >>>> > On Thursday, May 22, 2014 1:45:53 PM UTC+5:30, Daniel Roseman wrote: >>>> > On Tuesday, 20 May 2014 19:29:06 UTC+1, Aseem Bansal wrote: >>>> > I am working on a BookMarker project for managing my bookmarks. I was >>>> creating the search page for lisitng bookmarks as per categories. I hit a >>>> snag while testing it. I am unable to open locally stored webpages. I >>>> understand that it is for security purposes but is it possible >>>> (cross-browser way) to grant permissions for a app to open locally stored >>>> files? The app can ask for permissions for this. >>>> > >>>> > You'll need to be a bit clearer. Ignoring for the moment the fact >>>> that the client and the server are the same machine in development, are >>>> you >>>> hoping for your server to be able to open pages stored locally on your >>>> client? That's not going to be possible, for what I hope are obvious >>>> reasons. If that's not what you mean, you should explain in more detail. >>>> > -- >>>> > DR. >>>> > >>>> > -- >>>> > 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 post to this group, send email to django...@googlegroups.com. >>>> > Visit this group at http://groups.google.com/group/django-users. >>>> > To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/django-users/7df2d6a2-dcc9-4551-8617-a4eb30003926%40googlegroups.com. >>>> >>>> >>>> > For more options, visit https://groups.google.com/d/optout. >>>> >>>> -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/85f54280-fc3b-453b-87a5-cebffb643795%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: BookMarker Project - Opening local files on localhost through Django generated pages
I had searched that but there should be a way to give permissions. The client can give the permissions. Can the client not? On Thursday, May 22, 2014 11:28:59 PM UTC+5:30, François Schiettecatte wrote: > > It would also help to know what is giving the error. > > I did a quick google search with the text of the error (which you could > have done), it looks like browsers are not keen on accessing 'file://...' > urls from a web page served by a web server, this for security reasons. For > kicks, I embedded a link to 'file:///Users/francois/Sites/index.html' in a > page served by the django sandbox web server ( 'python manage.py runserver' > ), and none of the browsers I tried would access this file (Safari, FF, > Chrome, IE). > > François > > On May 22, 2014, at 1:39 PM, C. Kirby > > wrote: > > > Errors without code aren't very useful. If you provide the view and > template you are rendering it will give us something to latch onto and > debug > > > > Kirby > > > > On Thursday, May 22, 2014 12:23:06 PM UTC-5, Aseem Bansal wrote: > > I understand the requirement of file protocol. That's how I keep > bookmarks in Chrome currently. But when I served the same as a hyperlink I > am getting Not allowed to load local resource: > > > > On Thursday, May 22, 2014 10:14:39 PM UTC+5:30, François Schiettecatte > wrote: > > You can do this with a 'file://...' url, that will cause the browser to > open a file on the local file system, the browser won't need to ask for > permission, the only issue is that the files will need to be in a known > path. > > > > François > > > > On May 22, 2014, at 12:34 PM, Aseem Bansal wrote: > > > > > The server will not be able to open pages stored on client machine but > the client user should be able to open html pages stored on client machine > by clicking on a hyperlink manually. > > > > > > On Thursday, May 22, 2014 10:02:52 PM UTC+5:30, Aseem Bansal wrote: > > > I want the the webpage served to the client machine from the server to > have a hyperlink. The hyperlink will be for a html file stored on the > client machine. After the webpage has been served to the client webbrowser > then when the client user clicks on the hyperlink I want the html page to > be opened in the webbrowser. The webbrowser can ask for the permissions if > necessary. > > > > > > Basically I want a interface where I can manage my bookmarks - offline > or online for which I am making this. So any ideas now? > > > > > > On Thursday, May 22, 2014 1:45:53 PM UTC+5:30, Daniel Roseman wrote: > > > On Tuesday, 20 May 2014 19:29:06 UTC+1, Aseem Bansal wrote: > > > I am working on a BookMarker project for managing my bookmarks. I was > creating the search page for lisitng bookmarks as per categories. I hit a > snag while testing it. I am unable to open locally stored webpages. I > understand that it is for security purposes but is it possible > (cross-browser way) to grant permissions for a app to open locally stored > files? The app can ask for permissions for this. > > > > > > You'll need to be a bit clearer. Ignoring for the moment the fact that > the client and the server are the same machine in development, are you > hoping for your server to be able to open pages stored locally on your > client? That's not going to be possible, for what I hope are obvious > reasons. If that's not what you mean, you should explain in more detail. > > > -- > > > DR. > > > > > > -- > > > 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 post to this group, send email to django...@googlegroups.com. > > > Visit this group at http://groups.google.com/group/django-users. > > > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/7df2d6a2-dcc9-4551-8617-a4eb30003926%40googlegroups.com. > > > > > For more options, visit https://groups.google.com/d/optout. > > > > > > -- > > 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 post to this group, send email to > > django...@googlegroups.com. > > > V
Re: BookMarker Project - Opening local files on localhost through Django generated pages
There has to be a workaround. Using webbrowser.open via a request to the server on clicking? That's hacky but I started working on Django for this project and if web browsers cannot do this then I made a wrong choice for the technology to use for this project. On Thursday, May 22, 2014 11:46:49 PM UTC+5:30, François Schiettecatte wrote: > > See my previous email, you can get chrome to launch with securities turned > off (and Chromium too with the same command line argument), but not Firefox > or Safari, not sure about IE. Not even sure if the flag I mentioned will > help in this specific case. > > And I am not sure about the wisdom of running a web browser with > securities off. > > Regardless this is not a django issue but a browser issue, so this is not > the forum for this question :) > > François > > On May 22, 2014, at 2:10 PM, Aseem Bansal > > wrote: > > > I had searched that but there should be a way to give permissions. The > client can give the permissions. Can the client not? > > > > On Thursday, May 22, 2014 11:28:59 PM UTC+5:30, François Schiettecatte > wrote: > > It would also help to know what is giving the error. > > > > I did a quick google search with the text of the error (which you could > have done), it looks like browsers are not keen on accessing 'file://...' > urls from a web page served by a web server, this for security reasons. For > kicks, I embedded a link to 'file:///Users/francois/Sites/index.html' in a > page served by the django sandbox web server ( 'python manage.py runserver' > ), and none of the browsers I tried would access this file (Safari, FF, > Chrome, IE). > > > > François > > > > On May 22, 2014, at 1:39 PM, C. Kirby wrote: > > > > > Errors without code aren't very useful. If you provide the view and > template you are rendering it will give us something to latch onto and > debug > > > > > > Kirby > > > > > > On Thursday, May 22, 2014 12:23:06 PM UTC-5, Aseem Bansal wrote: > > > I understand the requirement of file protocol. That's how I keep > bookmarks in Chrome currently. But when I served the same as a hyperlink I > am getting Not allowed to load local resource: > > > > > > On Thursday, May 22, 2014 10:14:39 PM UTC+5:30, François Schiettecatte > wrote: > > > You can do this with a 'file://...' url, that will cause the browser > to open a file on the local file system, the browser won't need to ask for > permission, the only issue is that the files will need to be in a known > path. > > > > > > François > > > > > > On May 22, 2014, at 12:34 PM, Aseem Bansal > wrote: > > > > > > > The server will not be able to open pages stored on client machine > but the client user should be able to open html pages stored on client > machine by clicking on a hyperlink manually. > > > > > > > > On Thursday, May 22, 2014 10:02:52 PM UTC+5:30, Aseem Bansal wrote: > > > > I want the the webpage served to the client machine from the server > to have a hyperlink. The hyperlink will be for a html file stored on the > client machine. After the webpage has been served to the client webbrowser > then when the client user clicks on the hyperlink I want the html page to > be opened in the webbrowser. The webbrowser can ask for the permissions if > necessary. > > > > > > > > Basically I want a interface where I can manage my bookmarks - > offline or online for which I am making this. So any ideas now? > > > > > > > > On Thursday, May 22, 2014 1:45:53 PM UTC+5:30, Daniel Roseman wrote: > > > > On Tuesday, 20 May 2014 19:29:06 UTC+1, Aseem Bansal wrote: > > > > I am working on a BookMarker project for managing my bookmarks. I > was creating the search page for lisitng bookmarks as per categories. I hit > a snag while testing it. I am unable to open locally stored webpages. I > understand that it is for security purposes but is it possible > (cross-browser way) to grant permissions for a app to open locally stored > files? The app can ask for permissions for this. > > > > > > > > You'll need to be a bit clearer. Ignoring for the moment the fact > that the client and the server are the same machine in development, are you > hoping for your server to be able to open pages stored locally on your > client? That's not going to be possible, for what I hope are obvious > reasons. If that's not what you mean, you should explain in more detail.
Re: BookMarker Project - Opening local files on localhost through Django generated pages
This bookmarker that I want to make will be th repacement for my webbrowser's boomarks so I will be storing the bookmarks in sqlite DB. As per my understanding using html5 local storage is more of a temporary storage. A sqlite3 db will be portable hence keeping my bookmarks with me in case I want to transfer computers. Didn't get what will be insecure?Storage into sqlite3 db or turning off web browser's security? I am not going to hold it against the framework. I am just going to look for a workaround. There is always a workaround. Client and server are on the same machine and they will be even after this is complete so why cannot I just ask the server to open the webpage? The security applies to browser's not allowing file protocol but my project's code is Python and there is webbrowser module available to server. Couldn't I just ask the server to open the webpage? They are after all on same machine. Any problems in that or am I missing something here? On Friday, May 23, 2014 12:03:09 AM UTC+5:30, C. Kirby wrote: > > There are not really any workarounds, just different architecture - save > your bookmarks to the django project instead of on the local filesystem. > You can also look into using html5 local storage. Just note that either of > these architecture changes would mean rolling your own bookmark system > instead of utilizing the one you use now. It is fundamentally insecure to > do it the way you want to do it, and unlikely to be hacked around. > Sometimes projects fail due to outside forces or not completely > understanding the problem domain. This may be one of those cases, and that > is unfortunate. > If this is your first experience with django, don't hold it against the > framework - the issue you have run into unequivocally has nothing to do > with django. You would run into the same issue using any web framework in > any language. > > On Thursday, May 22, 2014 1:22:18 PM UTC-5, Aseem Bansal wrote: >> >> There has to be a workaround. Using webbrowser.open via a request to the >> server on clicking? That's hacky but I started working on Django for this >> project and if web browsers cannot do this then I made a wrong choice for >> the technology to use for this project. >> >> On Thursday, May 22, 2014 11:46:49 PM UTC+5:30, François Schiettecatte >> wrote: >>> >>> See my previous email, you can get chrome to launch with securities >>> turned off (and Chromium too with the same command line argument), but not >>> Firefox or Safari, not sure about IE. Not even sure if the flag I mentioned >>> will help in this specific case. >>> >>> And I am not sure about the wisdom of running a web browser with >>> securities off. >>> >>> Regardless this is not a django issue but a browser issue, so this is >>> not the forum for this question :) >>> >>> François >>> >>> On May 22, 2014, at 2:10 PM, Aseem Bansal wrote: >>> >>> > I had searched that but there should be a way to give permissions. The >>> client can give the permissions. Can the client not? >>> > >>> > On Thursday, May 22, 2014 11:28:59 PM UTC+5:30, François Schiettecatte >>> wrote: >>> > It would also help to know what is giving the error. >>> > >>> > I did a quick google search with the text of the error (which you >>> could have done), it looks like browsers are not keen on accessing >>> 'file://...' urls from a web page served by a web server, this for security >>> reasons. For kicks, I embedded a link to >>> 'file:///Users/francois/Sites/index.html' in a page served by the django >>> sandbox web server ( 'python manage.py runserver' ), and none of the >>> browsers I tried would access this file (Safari, FF, Chrome, IE). >>> > >>> > François >>> > >>> > On May 22, 2014, at 1:39 PM, C. Kirby wrote: >>> > >>> > > Errors without code aren't very useful. If you provide the view and >>> template you are rendering it will give us something to latch onto and >>> debug >>> > > >>> > > Kirby >>> > > >>> > > On Thursday, May 22, 2014 12:23:06 PM UTC-5, Aseem Bansal wrote: >>> > > I understand the requirement of file protocol. That's how I keep >>> bookmarks in Chrome currently. But when I served the same as a hyperlink I >>> am getting Not allowed to load local resource: >>> > > >>> > > On Thursday, May 22, 2
Re: BookMarker Project - Opening local files on localhost through Django generated pages
I am averse to doing that because I have offline bookmarks like the Python documentation also which contain a lot of links. If I rendered it as text then this problem will go in an loop. The browser will not allow any of the rendered links on that page to be opened. So a solution is needed. That is why I am considering using the fact that browser and server are on same machine. Instead of rendering the links on my search page I can instead render reference numbers which I can use to send requests to the server. Then the server will be able to use webbrowser.open for opening the required webpage. A little change will help me solve this problem. I guess I need to thank Daniel Roseman. If he had not mentioned that client and server are on same machine explicitly I would never have looked at the possible benefits of this. I understand that this is not a good solution as this makes my implementation dependent on client and server being on same machine. I am also considering using JavaScript window.open in the onclick of the bookmark. That way it might work. Need to check. On Friday, May 23, 2014 12:24:13 AM UTC+5:30, C. Kirby wrote: > > If they are always going to be on the same machine then why don't you open > the file on the view side and render it as text to the browser? > > > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a4464422-9065-4245-bb7f-26a8c70053dd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: BookMarker Project - Opening local files on localhost through Django generated pages
Just wanted to say that window.open failed for locally stored files. Guess browser security is good in Chrome. -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d0c63de4-7289-4e3d-8079-9094bacffb67%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: BookMarker Project - Opening local files on localhost through Django generated pages
I guess I should tell that the thing worked. Using server to open the web pages worked. I made ajax calls via jQuery to the server and used code there to do the rest. A bummer out of way. Just adding here in case someone is doing the same thing in future. :D -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2543446c-27b1-4ab8-ab2e-42031d21099a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Anyone interested in reviewing the code of a small project - BookMarker
So I am making a hobby project which can be seen here https://github.com/anshbansal/Bookmarker . This is my first time working with Django/jQuery and first personal web app project. Is there anyone interested in reviewing the code? I am willing to give any explanations if necessary. -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/011746d8-d628-4749-a0e9-5b7fcc477555%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Anyone interested in reviewing the code of a small project - BookMarker
Thanks Shmengie. I was thinking of using class based views as it was pointed in tutorial that they are better but I was not sure which ones are good here. So I decided to prioritize making it work and then go for refactoring. CSS location I will change. The tutorials used include's but I didn't get the benefit of using that in a small project. I mean in a program I can think of independent units and turn them into functions but in HTML how do you go about breaking it into parts? I mean the thought process for deciding the parts. If I have many files then I can extract the common things but for a single file I am not sure how to go about that. Partials refers to the sub-templates. Correct? Custom template tags - I'll put that on my TODO list for later reading. On Monday, May 26, 2014 7:28:02 PM UTC+5:30, shmengie wrote: > > Looks like you're getting a handle on django. > You're not using Class Based Views, but you import generic. Since you're > getting familiar with django, you *might* want to hold off on delving into > CBVs. They're very powerful and can reduce coding, but can be difficult to > wrap your head around. > > Once you've created your app with functions, then perhaps go back and wrap > 'em in CBV's. CBV's have a lot of power, but while learning the basics, > sticking with functions can be a lot less assimilate all at once. > > In your template, you have CSS at the bottom. CSS is typically linked in > the section. I suppose most web browsers today are okay > either way. Javascript/jquery is typically near the end of the html, as > you have it. > > I wish w3c/html5 spec'd tags for and > locations. Javascript more than css links seem feel sloppy to me, ahh > well, it is what it is. > > Next, I suspect you might want to work on a base.html and working with > {{include's}}. It's a fairly easy concept to grasp and some of the beauty > of django's templating. I wouldn't recommend delving into custom template > tags yet, but it's good to know they exist. > > You're template is not complex, being familiar with partials is an easy > way to keep it *simpler.* > > -Joe > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/33c0987a-9edb-42dc-b37a-28c6273d2253%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Anyone interested in reviewing the code of a small project - BookMarker
I am using webbrowser library because this project is supposed to store bookmarks instead of my browser. Storing bookmarks in a app is useful only if there is a way to open them via the app. I was initially serving the bookmarks as hyperlinks but then came across a problem. Web browser's were not allowing me to open locally stored web pages. So I decided to open the webpages through webbrowser library as client viewing the page and server are on same machine. Relevant discussion on this forum https://groups.google.com/forum/#!topic/django-users/rSqSftkl5mg Ask in case any confusions. On Monday, May 26, 2014 9:49:47 PM UTC+5:30, Andre Terra (airstrike) wrote: > > Why are you using the webbrowser library? I don't see how it makes sense.. > > > Cheers, > AT > > > On Mon, May 26, 2014 at 12:32 PM, Aseem Bansal > > > wrote: > >> Thanks Shmengie. I was thinking of using class based views as it was >> pointed in tutorial that they are better but I was not sure which ones are >> good here. So I decided to prioritize making it work and then go for >> refactoring. CSS location I will change. >> >> The tutorials used include's but I didn't get the benefit of using that >> in a small project. I mean in a program I can think of independent units >> and turn them into functions but in HTML how do you go about breaking it >> into parts? I mean the thought process for deciding the parts. If I have >> many files then I can extract the common things but for a single file I am >> not sure how to go about that. >> >> Partials refers to the sub-templates. Correct? >> >> Custom template tags - I'll put that on my TODO list for later reading. >> >> On Monday, May 26, 2014 7:28:02 PM UTC+5:30, shmengie wrote: >>> >>> Looks like you're getting a handle on django. >>> You're not using Class Based Views, but you import generic. Since >>> you're getting familiar with django, you *might* want to hold off on >>> delving into CBVs. They're very powerful and can reduce coding, but can be >>> difficult to wrap your head around. >>> >>> Once you've created your app with functions, then perhaps go back and >>> wrap 'em in CBV's. CBV's have a lot of power, but while learning the >>> basics, sticking with functions can be a lot less assimilate all at once. >>> >>> In your template, you have CSS at the bottom. CSS is typically linked in >>> the section. I suppose most web browsers today are okay >>> either way. Javascript/jquery is typically near the end of the html, as >>> you have it. >>> >>> I wish w3c/html5 spec'd tags for and >>> locations. Javascript more than css links seem feel sloppy to me, ahh >>> well, it is what it is. >>> >>> Next, I suspect you might want to work on a base.html and working with >>> {{include's}}. It's a fairly easy concept to grasp and some of the beauty >>> of django's templating. I wouldn't recommend delving into custom template >>> tags yet, but it's good to know they exist. >>> >>> You're template is not complex, being familiar with partials is an easy >>> way to keep it *simpler.* >>> >>> -Joe >>> >> -- >> 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 post to this group, send email to django...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/33c0987a-9edb-42dc-b37a-28c6273d2253%40googlegroups.com<https://groups.google.com/d/msgid/django-users/33c0987a-9edb-42dc-b37a-28c6273d2253%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/44ba1e07-457c-40b7-b205-c179bf9de010%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Anyone interested in reviewing the code of a small project - BookMarker
Background? I have some experience(a few months only) with Java 6/Struts 1.2 for web development. Started working on Python May 2013. Not continuously but as a hobby for scripting purposes and some automation. I guess my github and stackoverflow account can give you a better idea https://github.com/anshbansal/general http://stackoverflow.com/users/2235567/aseem-bansal On Tuesday, May 27, 2014 7:09:47 PM UTC+5:30, shmengie wrote: > > Partials/sub-templates are the same. > > For a small one pager, includes aren't very useful. As for the logic in > using them, that's more difficult to elaborate since it depends a lot on > the layout and design of the site. > > There are a couple of different types of "sub sections" you can > implement. html fragments, which are useful in larger sites. Then there > are fragments of css/js which even tho it's all html, I refer to html as > presentation code and css/js as links/includes. For a larger site this is > more useful, but since you're using this as a learning tool, why not > implement concepts that are useful in larger sites. > > I referenced the custom tags, because you can dynamically include CSS & > Javascript (partials) based on rules with them. Which is a nifty concept, > though I've seen it used, Ive not implemented them myself I don't > wish to push too much on your plate, w/out knowing your background, but > this might be a good concept for you to tackle at this point. > > > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/52ef59f5-8e13-4c4f-9988-6d9264bcca6d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Anyone interested in reviewing the code of a small project - BookMarker
Anyone interested in reviewing updated code? Now the search functionality is working. I have added comments and a link with screenshots of working functionality. Also refactoring done in the Javascript to make code easier to read. I think the functionality should be clearer by the changed code now. I have added a partial for rendering as was suggested. There are some parts of code which can be improved but I don't know exactly how to implement the changes. Like the Javascript needs the static URL for addition of categories on screen. It can be done in a much better way if I can use a partial here. But I am not sure how to render a partial by the html() function of a javascript. Any ideas? On Tuesday, May 27, 2014 8:26:20 PM UTC+5:30, Aseem Bansal wrote: > > Background? I have some experience(a few months only) with Java 6/Struts > 1.2 for web development. Started working on Python May 2013. Not > continuously but as a hobby for scripting purposes and some automation. I > guess my github and stackoverflow account can give you a better idea > https://github.com/anshbansal/general > http://stackoverflow.com/users/2235567/aseem-bansal > > On Tuesday, May 27, 2014 7:09:47 PM UTC+5:30, shmengie wrote: >> >> Partials/sub-templates are the same. >> >> For a small one pager, includes aren't very useful. As for the logic in >> using them, that's more difficult to elaborate since it depends a lot on >> the layout and design of the site. >> >> There are a couple of different types of "sub sections" you can >> implement. html fragments, which are useful in larger sites. Then there >> are fragments of css/js which even tho it's all html, I refer to html as >> presentation code and css/js as links/includes. For a larger site this is >> more useful, but since you're using this as a learning tool, why not >> implement concepts that are useful in larger sites. >> >> I referenced the custom tags, because you can dynamically include CSS & >> Javascript (partials) based on rules with them. Which is a nifty concept, >> though I've seen it used, Ive not implemented them myself I don't >> wish to push too much on your plate, w/out knowing your background, but >> this might be a good concept for you to tackle at this point. >> >> >> -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b766787d-1d44-4c70-98e2-037c7258ede8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Anyone interested in reviewing code for a hobby project - BookMarker
I last asked for a review around two weeks back for my project. Is anyone interested to give a second review for this project? https://github.com/anshbansal/Bookmarker The last thread was here https://groups.google.com/forum/#!topic/django-users/ob4fXz3GF9w in case someone wants to see that I actually respond to people's comments instead of just wasting their time. >From last time I have done these changes - 1 Bookmark update as per categories is now working 2 Used templates to make some things simpler to understand 3 Refactoring of view.py to get reusable components 4 Refactored jquery to make it cleaner so it is actually possible to read it 5 Added CDN of librarires and added backup in case no internet is present My main concern currently is that this project is turning out to have a lot more jQuery than Python/HTML. Am I designing this incorrectly? I understand that as my requirements are mostly asynchronous so there is a need for javascript but redundancy like hard-coding URLs for autocomplete in javascript is bothering me. Also am I over-engineering the Javascript? -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7e9454ae-80b1-4a6b-a63f-81d997f15704%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Anyone interested in reviewing code for a hobby project - BookMarker
Rendering the Javascript through Django template engine. Noted. I am trying to keep it simple but I am not an expert. Asked for a review. Chip in if you are interested. http://codereview.stackexchange.com/questions/53896/personal-project-for-managing-my-bookmarks On Monday, June 9, 2014 7:01:47 PM UTC+5:30, shmengie wrote: > > > > On Saturday, June 7, 2014 6:07:52 AM UTC-4, Aseem Bansal wrote: > >> >> My main concern currently is that this project is turning out to have a >> lot more jQuery than Python/HTML. Am I designing this incorrectly? I >> understand that as my requirements are mostly asynchronous so there is a >> need for javascript but redundancy like hard-coding URLs for autocomplete >> in javascript is bothering me. Also am I over-engineering the Javascript? >> > > > Can't say I delved real deep into your efforts. My comments on your > observations. > > A lot of us like django because there's less code involved. > > You can get around hard coding by rendering javascript (or some code > segments) through the template engine. > > I find the simpler you keep javascript, the easier it is to maintain. > Maybe HTML7 will encompass a new scripting language. ;) > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/18c231d2-b3d7-4701-965e-a528d27bf3cc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Anyone interested in reviewing code for a hobby project - BookMarker
I did not understand what you said regarding having a standard layout. I mean I am already using the layout that was explained in the Django tutorials. Keeping all my HTML in the template directory and all static files in the static directory with namespacing with the app name which is BookMarker. Is there some other layout? I used CharField instead of URLField because there is a problem with URLField. It is not allowing me to add local files as bookmarks which is actually valid URL. I mean currently I have bookmarks in my browser like file:///D:/Study/Docs/Python/python-3.4.0-docs-html/index.html It is perfectly valid URL but URLField is marking it as invalid. So I used CharField. The second part about relative imports. I have never understood how relative imports work. I mean the syntax. I have went through the PEP to understand it and did a lot of google searches but that is something that I never got the hang of. Is there any specific reason that I should be using them? The app's goal is for me to be able to us this app for storing and using my bookmarks through the app instead of my webbrowser. The problem is that I have lot of bookmarks. Both offline and online bookmarks which I am currently maintaining in a multiple hierarchy of bookmark folders. It is going messy. I need this app to be an application that I can use to add, update, delete, view bookmarks by categories. Adding, deleting categories and searching by categories is also necessary for me to switch to this app. Otherwise there is no benefit. The reason I am using autocomplete is that I want searching for categories easier. Same goes for already added bookmarks. Would you like to use an app that won't autocomplete? Nobody will including myself. The reason for opening a webbrowser is that I need to be able to use my bookmarks through this app. I can serve the bookmarks as hyperlinks on which a simple click can do the job of opening the webpage. But browser security does not allow me to open locally stored bookmarks like the one I gave above to be opened this way. When I came to know about this thing I had two choices - switch to a GUI framework or find an acceptable workaround. As my server and client or on the same machine and the security of browser do not apply to my Python installation I chose to send the request of opening the bookmark to server which will be able to open both offline and online bookmarks. I understand the need for documentation but I think as there is an assumption of server and client on same machine for opening the bookmarks no one will want to use it anyway. Bad jokes aside, I am learning Django, Javscript/jQuery through this project I don't feel comfortable adding another topic to learn side-by-side alongwith my job. My goal is to make an app for personal use. If I add too much things to learn at the same time I will lose the interest that keeps me going. I will consider making one the proper way when I am more comfortable with these things and I have an idea which is reusable. If there is anything else please let me know. I will try my best to explain. On Tuesday, June 10, 2014 6:48:59 PM UTC+5:30, trojactory wrote: > > Aseem, > > I had a quick look at your Django app and here are some of my observations: > > >1. Most Django apps have a standard layout with the app in a directory >named after itself. See django-taggit > > <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Falex%2Fdjango-taggit&sa=D&sntz=1&usg=AFQjCNE_8owJgA8itHuBmLu9UwortstXOw> > >for instance. >2. You have made some unconventional choices which needs to be >explained like using CharField instead of URLField, not using relative >paths in imports etc. >3. An app must do one thing really well in order to be most reusable. >I believe autocomplete and opening a web browser don't belong to a >bookmarking app. >4. There needs to be more unit tests and documentation to increase >confidence of other developers in using the app. > > Sorry, if I have misunderstood the objectives of your project, but these > things stood out to me. > > Cheers, > Arun > > > On Saturday, 7 June 2014 15:37:52 UTC+5:30, Aseem Bansal wrote: >> >> I last asked for a review around two weeks back for my project. Is anyone >> interested to give a second review for this project? >> >> https://github.com/anshbansal/Bookmarker >> >> The last thread was here >> https://groups.google.com/forum/#!topic/django-users/ob4fXz3GF9w in case >> someone wants to see that I actually respond to people's comments instead >> of just wasting their time. >> >> From last time I have done these changes - >> 1 Bookmark update as per categories is now working >> 2 Used templ