Open emieza opened 9 years ago
12/12/2014
I'll think about it, i'll think about it...
Ok! lets code!
One hint to add images to the model:
For the user profile seems reasonable to use Django backend :)
Finished! (I think...)
For testing go to /register (register new users), or index (view and create new posts)
I would like to know how an image is stored in django (which directory) to do the src tag in the posts template !
you only have to create a new directory under /web named media. You don't have to specify the whole path in the src attribute to the image in the html code, django will do it for us. for example in latest_posts template:
<img src='{{MEDIA_URL}}{{post.image}}' width=40%>
the MEDIA URL is configured in the settings file ('/media/') and post.image will be a folder inside /media named /user_images (you don't have to create it). you can try it in your development environment.
ty ! Im already installing Pillow. Nice work !
On Thu, Feb 12, 2015 at 11:19 AM, José Pedro Rusakiewicz < notifications@github.com> wrote:
you only have to create a new directory under /web named media. You don't have to specify the whole path in the src attribute to the image in the html code, django will do it for us. for example in latest_posts template:
![]()
the MEDIA URL is configured in the settings file ('/media/') and post.image will be a folder inside /media named /user_images (you don't have to create it). you can try it in your development environment.
— Reply to this email directly or view it on GitHub https://github.com/lacetans/faceschool/issues/8#issuecomment-74047711.
why do you need Pillow? I didn't need that!
Fuck then :/
On Thu, Feb 12, 2015 at 11:27 AM, José Pedro Rusakiewicz < notifications@github.com> wrote:
why do you need Pillow? I didn't need that!
— Reply to this email directly or view it on GitHub https://github.com/lacetans/faceschool/issues/8#issuecomment-74048753.
web.FSUser.main_image: (fields.E210) Cannot use ImageField because Pillow is not installed. HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install pillow". web.FSUser.profile_image: (fields.E210) Cannot use ImageField because Pillow is not installed. HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install pillow". web.Post.image: (fields.E210) Cannot use ImageField because Pillow is not installed. HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install pillow".
(0_0) what? are you using django v1.7?
import django django.VERSION (1, 7, 1, 'final', 0)
On Thu, Feb 12, 2015 at 11:31 AM, José Pedro Rusakiewicz < notifications@github.com> wrote:
(0_0) what? are you using django v1.7?
— Reply to this email directly or view it on GitHub https://github.com/lacetans/faceschool/issues/8#issuecomment-74049386.
We'll check it later, don' worry.
still ty :)
On Thu, Feb 12, 2015 at 11:36 AM, Lu Chinke lucham1995@gmail.com wrote:
import django django.VERSION (1, 7, 1, 'final', 0)
On Thu, Feb 12, 2015 at 11:31 AM, José Pedro Rusakiewicz < notifications@github.com> wrote:
(0_0) what? are you using django v1.7?
— Reply to this email directly or view it on GitHub https://github.com/lacetans/faceschool/issues/8#issuecomment-74049386.
Oh sorry! my mistake! I thought it was included by default. yes you have to install pillow.
Nice. The next question is :
Did you needed to add columns to sqlite for images?
/// Exception Value: no such column: web_post.image
Exception Location: /home/funky/env/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py in execute, line 485
On Thu, Feb 12, 2015 at 11:42 AM, José Pedro Rusakiewicz < notifications@github.com> wrote:
Oh sorry! my mistake! I thought it was included by default. yes you have to install pillow.
— Reply to this email directly or view it on GitHub https://github.com/lacetans/faceschool/issues/8#issuecomment-74050681.
nope. did you makemigrations and migrate? before that, I made another push yesterday.
Saw it. I updated all today. You forgot an upload_path on Posts. I defined this one as 'posts_images' and created the directory inside media. Ill keep trying with makemigatrions.
here's the post model in the last push i made:
class Post(models.Model):
upload_path = 'users_images'
i'ts working for me. you can look that in https://github.com/lacetans/faceschool/blob/image/web/models.py
allusers images (posts, profile and wall) are saved in users_images.
you don't have to create any directory inside media django will do it for you.
you can try to delete the sqlite db file and try again with makemigrations and migrate.
Perfect. Thanks!
On Thu, Feb 12, 2015 at 12:33 PM, José Pedro Rusakiewicz < notifications@github.com> wrote:
you can try to delete the sqlite db file and try again with makemigrations and migrate.
— Reply to this email directly or view it on GitHub https://github.com/lacetans/faceschool/issues/8#issuecomment-74057002.
Problema detectat!! després d'enviar un formulari de post, si l'usuari refresca la pàgina es torna a eviar el formulari creant posts duplicats!!! He estat buscant i he trobat això: http://en.wikipedia.org/wiki/Post/Redirect/Get
Ho hauríem d'implementar en Django
Add image upload to:
Think about two issues: