Skip to main content

Posts

Showing posts with the label programming

Django: add image in an ImageField from image url

Today I had experience with django file downloads from an specified url into Django model FileField. I'm writing content grabber from Flickr. I didn't find information about it and decided to write what I've discovered so far in example. Stackoverflow helped me a bit. But answer proposed there had not worked. So this is code example how to workout this issue: because code worth a thousand words :) We have a model with one field: #models.py class Photo ( models . Model ):     image = models . ImageField ( 'Label' , upload_to = 'path/' ) We need to create a photo from image url and save it to the model's FileField. #somewhere in views.py # usually in header imports from urlparse import urlparse import urllib2 from django . core . files import File   #add imprt of content file wrapper from django . core . files . base import ContentFile # somewhere: for e.g. in view handling the file operations photo = Photo () img_url =...

How to setup Git to work with Eclipse.

Git is a best version control system, as for me. That's why I decided to write a few words about setting up a git GUI for yourself. I assume you use Eclipse for your everyday coding. As long as your project is small and you simply committing for co-working with other project members everything is ok with command line tools of Git. I made commits on a daily basis. Main commands I used was: "git add", "git remove", "git commit -m", "git push"... It's ok when you commit 5 to 20 files. You can manually add them. It takes about some minutes. One day a project grown up.  Commits became a hard typing work. So that's the manual how to befriend your Eclipse with Git(hub). 1. Install Eclipse plugin called EGit. It is well documented and highly sophisticated Eclipse plugin for working with Git. You can read almost any step of setting up this plugin in it's official docs: http://wiki.eclipse.org/EGit/User_Guide . It's quite cool a...

Hello World!

Hi! I'm a junior web developer/programmer studying Python/JavaScript programming. In this blog I'll try to publish my findings and things I achieved or studied so far. So I'm working with: - Python - Django - JavaScript - jQuery My Github is:     garmoncheg I'm making an OpenSource project Gphblog (Garmoncheg's Photo Blog) there. Feel free to contact me about any topic listed here...