Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Server Error on preview #54

Open
iLikeKoffee opened this issue Dec 10, 2015 · 3 comments
Open

Internal Server Error on preview #54

iLikeKoffee opened this issue Dec 10, 2015 · 3 comments

Comments

@iLikeKoffee
Copy link

iLikeKoffee commented Dec 10, 2015

Hello, I tried to install this library on Django 1.9 and got such error in admin interface when tried to run preview.

Internal Server Error: /markdown/preview/
Traceback (most recent call last):
  File "/home/alexey/Dev/profcom/django-rest-env/lib/python3.4/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/alexey/Dev/profcom/django-rest-env/lib/python3.4/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/alexey/Dev/profcom/django-rest-env/lib/python3.4/site-packages/django_markdown/views.py", line 22, in preview
    content=request.REQUEST.get('data', 'No content posted'),
AttributeError: 'WSGIRequest' object has no attribute 'REQUEST'
[10/Dec/2015 22:14:47] "POST /markdown/preview/ HTTP/1.1" 500 14951

Here is the model code

class Post(models.Model):
    name = models.CharField(max_length=50, null=False, primary_key=True)  # Name for human-readable url
    title = models.CharField(max_length=255, null=False, unique=True)  # Human-readable title
    text = MarkdownField()  # Text in markdown syntax
    documents = models.ManyToManyField('Document', blank=True)
    commission = models.ForeignKey('Commission', related_name="posts")
    pinned = models.BooleanField(default=False)  # Should display on main
    date = models.DateTimeField(auto_now=True)
    image = models.FileField(upload_to='post_tiles', null=True)

Is it compatible with django 1.9?
Thank you in advance!

Sinclerely, Alexey


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@noisytoken
Copy link

I am facing the same issue.

@macskay
Copy link

macskay commented Jan 23, 2016

Someone opened a PR (#60) about this. Until it is not merged just alter your views.py of django_markdown. Worked for me perfectly.

@jarifibrahim
Copy link

request.REQUEST was deprecated in Django 1.7, and removed in Django 1.9.

Open the file views.py inside django_markdown folder and go to line 22, and change the following line

content=request.REQUEST.get('data', 'No content posted')

to

content=request.POST.get('data', 'No content posted')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants