Anyone interested in reviewing the code of a small project - BookMarker

80 views
Skip to first unread message

Aseem Bansal

unread,
May 25, 2014, 7:20:38 AM5/25/14
to django...@googlegroups.com
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. 

Avraham Serour

unread,
May 25, 2014, 9:00:09 AM5/25/14
to django...@googlegroups.com
any explanation you think would be necessary should be documented, either in code comments and/or on the project wiki/readme
this is actually a very important part of the project, boring? yes, but this it the first (and maybe only) thing people will look


On Sun, May 25, 2014 at 2:20 PM, Aseem Bansal <asmba...@gmail.com> wrote:
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...@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/011746d8-d628-4749-a0e9-5b7fcc477555%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Phillips

unread,
May 25, 2014, 11:48:17 AM5/25/14
to django users

I took a quick look at your code and my first comment is to add comments to your code. I would like to read in your comments what you are trying to accomplish, and then I can look at the code with a more informed eye.

Mark

shmengie

unread,
May 26, 2014, 9:58:02 AM5/26/14
to django...@googlegroups.com
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 <head></head> 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 <css></css> and <script></script> 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

Aseem Bansal

unread,
May 26, 2014, 11:32:14 AM5/26/14
to django...@googlegroups.com
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.

Andre Terra

unread,
May 26, 2014, 12:19:47 PM5/26/14
to Django users
Why are you using the webbrowser library? I don't see how it makes sense..


Cheers,
AT


--
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.

Aseem Bansal

unread,
May 26, 2014, 1:03:10 PM5/26/14
to django...@googlegroups.com
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.


Ask in case any confusions.

shmengie

unread,
May 27, 2014, 9:39:47 AM5/27/14
to django...@googlegroups.com
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.


Aseem Bansal

unread,
May 27, 2014, 10:56:20 AM5/27/14
to django...@googlegroups.com
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 

Aseem Bansal

unread,
May 28, 2014, 4:26:56 PM5/28/14
to django...@googlegroups.com
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?
Reply all
Reply to author
Forward
0 new messages