When I try text editing and other text related stuffs and save it, the
editor does its job nicely. But when I try to upload an image it just take
a different url. I am on windows. Is it because of this, cause I saw a post
on this 
post<http://stackoverflow.com/questions/18894044/django-ckeditor-wont-render-images>,
but it didn't helped me either. It does get saved and they each have their
own thumbnails too. But its just that the wrong urls. I checked the src of
the image, and it was like this,

<img alt="" src="/media/3/10/17Hydrangeas.jpg" />

But it should have been like this,

<img alt="" src="/media/2013/10/17/Hydrangeas.jpg" />

And sometimes the src of the image is just like this,

<img alt="" src="/media/3/10/17" />

This is the snippet of my settings.py:

CKEDITOR_UPLOAD_PATH = 'C:/Users/Nanyoo/web/demo/media'
MEDIA_ROOT = 'C:/Users/Nanyoo/web/demo/media'

I've included its url in my urls.py:

(r'^ckeditor/', include('ckeditor.urls')),

models.py:

from django.db import modelsfrom datetime import datetimefrom
django.contrib.auth.models import Userfrom time import time

def get_upload_file_name(instance, filename):
    return "uploaded_files/%s_%s" %(str(time()).replace('.','_'), filename)
class Blog(models.Model):
    title = models.CharField(max_length=200)
    image = models.ImageField(upload_to=get_upload_file_name, blank=True)
    pub_date = models.DateTimeField(default=datetime.now)
    creator = models.ForeignKey(User, related_name="creator_set")
    body = models.TextField()

In the forms.py:

from django import formsfrom django_summernote.widgets import
SummernoteWidgetfrom ckeditor.widgets import CKEditorWidget
class BlogForm(forms.Form):
    title = forms.CharField(max_length=200,widget=SummernoteWidget())
    body = forms.CharField(widget=CKEditorWidget())

In the index.html:

        {% for blog in blogs %}
        <div id="page">
                <h1>{{ blog.title | safe}}</h1>
                <p>{{ blog.body | safe}}</p>
        </div>
        {% endfor %}

Please help me figure it out. Any help will be greatly appreciated!

Thanks!

-- 
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/CA%2B4-nGomdQf3%3DDbzArYUYeBdyjEhnVbDuc8KLmi%3DdwPsgBsROA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to