Problem: Ajax post method to django views

2019-11-08 Thread Mikko Meronen
Hi, I have a problem to pass a json value to Django views and use the value to retrieve data from my database. Anyone could help me? I get the ajax error message and the following error in chrome console: jquery.js:8475 POST http://www.topithenewsdoggy.com/history/ 403 (Forbidden) *views.py* d

Re: Django template

2019-02-08 Thread Mikko Meronen
nks. But if I do this way, how do I transfer data between back-end >>> and front-end? Do I use post request? >>> >>> >>> On Friday, February 8, 2019 at 8:35:28 PM UTC-5, Nitin Kalmaste wrote: >>>> >>>> You are correct, >>>> Yo

Re: Django template

2019-02-08 Thread Mikko Meronen
almaste wrote: >> >> You are correct, >> You are using HTML and JavaScript as template in django. You need to >> store static files like css/images/JavaScript in static folder and >> configure static folder in the settings file >> >> On Sat, Feb 9, 2019, 1:0

Re: Django timezone problem

2019-02-08 Thread Mikko Meronen
>>>> something like this: https://github.com/adamcharnock/django-tz-detect >>>> >>>> What it does is use javascript to get the timezone (which doesn't >>>> always return the right timezone) and then uses a middleware to set the >>>> timezone

Re: Django timezone problem

2019-02-08 Thread Mikko Meronen
ascript to get the timezone (which doesn't always >>> return the right timezone) and then uses a middleware to set the timezone >>> for the current user. That way you will get the information in the correct >>> timezone for the user according to the browser (which

Re: Django template

2019-02-08 Thread Mikko Meronen
Hi, Have to say that Im still beginner in Django and coding, but I think you just create you html files to your templates folder, and in the end you are basically using just html. Django can just find your html file from templates folder. Im just learning javascript and I assume i can save my js-

Re: Django timezone problem

2019-02-06 Thread Mikko Meronen
imezone) and then uses a middleware to set the timezone > for the current user. That way you will get the information in the correct > timezone for the user according to the browser (which might not be correct). > > Regards, > > Andréas > > > Den mån 4 feb. 2019 kl 15:04

Re: Django timezone problem

2019-02-04 Thread Mikko Meronen
e. > But instead of calling timezone.now() , call timezone.now. > > Or what is the exact issue are you facing? > > Regards, > Amitesh Sahay > *91-750 797 8619* > > > On Monday, 4 February, 2019, 12:30:07 AM IST, Mikko Meronen < > mikkovillemero...@gmail.com> wrot

Django timezone problem

2019-02-03 Thread Mikko Meronen
Hi, Is there any easy way in Django to catch end user's local time when end user access the webpage? I have read django documentation and tried to google solutions, but I get quite confused. Below you will find my code. In short the code should show a story on my webpage what happened in the past

Re: Search function problem in production environment

2018-10-19 Thread Mikko Meronen
The code seems to work in production environment after all, just needed to restart the site. - Mikko pe 19. lokak. 2018 klo 16.26 Mikko Meronen (mikkovillemero...@gmail.com) kirjoitti: > Hi again, > > I am trying to deploy a search function to my website. It works well in > the

Search function problem in production environment

2018-10-19 Thread Mikko Meronen
Hi again, I am trying to deploy a search function to my website. It works well in the development environment, but in the production side I get the error message below (and my codes). I appreciate a lot if someone could help me again. I'm using PythonAnywhere in production, if that matters. Best

Re: Instagram embedding

2018-10-13 Thread Mikko Meronen
Hi, It worked in production environment well, just not in development environment. - Mikko la 13. lokak. 2018 klo 17.39 Mikko Meronen (mikkovillemero...@gmail.com) kirjoitti: > Hi, > > I'm trying to embed Instagram to my development site by using a Instagram > embedding code,

Instagram embedding

2018-10-13 Thread Mikko Meronen
Hi, I'm trying to embed Instagram to my development site by using a Instagram embedding code, but when I add it to my html, I get the error below. I would appreciate a lot if someone could help me to understand the error and solve the problem. Best regards, - Mikko UnicodeDecodeError at /news/

Re: Views & Template issue

2018-09-12 Thread Mikko Meronen
jango.utils.timezone import now > > def index(request): > t = now() > newstest = NewsData.objects.filter(created__gt= t - > 300).order_by('-created') > newstest1 = NewsData.objects.filter(created__lt= t - > 300).order_by('-created') > args =

Re: Views & Template issue

2018-09-11 Thread Mikko Meronen
}} {{ news.published }} {{ news.publisher }} {{ news.section }} {{ news.country }} {% endfor %} ** * * * * * * * {% for c in newstest2 %}* * {{c}} * * * * {% endfor %}* * * * * * * * * {% for news1 in newstest1 %} {{ news1.title }} {{ news1.published }} {{ news1.publisher }} {{ news1.section }}

Re: Views & Template issue

2018-09-09 Thread Mikko Meronen
Thank you. -Mikko su 9. syysk. 2018 klo 16.49 Jason (jjohns98...@gmail.com) kirjoitti: > You've defined two views which pass in different querysets to be rendered. > > so if you hit index, you get the first queryset rendered but not the > second because newstest1 is not rendered at all. and vic

Views & Template issue

2018-09-09 Thread Mikko Meronen
Hi again, I'm trying to include two views in one html template, however the latter(bolded) view doesn't work. The first one works well and I can see the items created within last 15 minutes in my webpage. However when I want to see the older items (bolded html part and index1 in views.py), I don'

Re: Django database problem

2018-08-27 Thread Mikko Meronen
Kühne wrote: >>> >>> The management command could be wrapped within a transaction, this would >>> then in the database create a lot of models, but if the transaction fails - >>> the rollback will not reset the database id. >>> >>> Regards, >&

Re: Django database problem

2018-08-26 Thread Mikko Meronen
del > definitions. Models and ORM to interact with database. (Model)forms to > validate your incoming data etc. > > Also I really suggest that you do the official tutorial from the docs to > get hang of basic django concepts. > > ma 20. elok. 2018 klo 19.59 Mikko Meronen > kir

Re: Django database problem

2018-08-20 Thread Mikko Meronen
Hi and thanks for your help. I have tried postgress and now I have a problem using it. Here's my code following an error. I appreciate any help. def do(): x = 1 while x == 1: create_table() print('finding data') find_data() time.sleep(120) def create_table

Django database problem

2018-08-17 Thread Mikko Meronen
Hi, I'm quite new with django and python and I wish someone could help me. I'm building a webpage where my python program/bot collects data from webpages. Is there a way that I can use my python program to store the data to django's database? At the moment when I run my program, I collect the d

Re: Problem in part 6, CSS doesn't work

2018-05-30 Thread Mikko Meronen
3] "GET /favicon.ico HTTP/1.1" 404 2088 -Mikko 2018-05-30 2:16 GMT+03:00 Vijay Khemlani : > That's only for production environments, for development you don't need to > run that command > > Where did you finally put the css file and what path did you put in t

Re: Problem in part 6, CSS doesn't work

2018-05-29 Thread Mikko Meronen
Hi, Thank you, but I should have those correct. I did some googling and ran following: python manage.py collectstatic And I got this: Django-project\lib\site-packages\django\contrib\staticfiles\storage.py", line 43, in path raise ImproperlyConfigured("You're using the staticfiles app " djan

Re: Problem in part 6, CSS doesn't work

2018-05-26 Thread Mikko Meronen
In PowerShell it says: [26/May/2018 17:45:14] "GET /static/polls/style.css HTTP/1.1" 404 1669 2018-05-26 17:42 GMT+03:00 Mikko Meronen : > Hi, > > Still the same problem :( > > Mikko > > 2018-05-26 17:30 GMT+03:00 Dylan Reinhold : > >> Mikko, >>

Re: Problem in part 6, CSS doesn't work

2018-05-26 Thread Mikko Meronen
der folder down into > polls/static/polls/style.css > > Dylan > > On Sat, May 26, 2018 at 6:52 AM, Mikko Meronen < > mikkovillemero...@gmail.com> wrote: > >> Hi, >> >> I can't get the CSS code to work. Link color doesn't change to green nor &g

Problem in part 6, CSS doesn't work

2018-05-26 Thread Mikko Meronen
Hi, I can't get the CSS code to work. Link color doesn't change to green nor the background image appear. What could be the problem? The CSS code is in Wordpad. polls/static/polls/images/style.css: li a { color: green; } body { background: white url("images/background.gif") no-repeat; } p

Re: Django-admin problem

2018-05-04 Thread Mikko Meronen
Thank you for your help. I also found a video that helped me with PowerShell (just if someone else has the same problem): https://www.youtube.com/watch?v=3TqO5FfhV28 2018-05-04 21:27 GMT+03:00 Matthew Pava : > And you’re using PowerShell instead of the command prompt. I typically > just work i