Re: button not responding when click but when press return key than works

2018-06-13 Thread Fidel Leon
If I remember correctly, the correct tag for a button is [obviously]
, no  (please see the missing T).

El jue., 14 jun. 2018 a las 0:14, Asif Khan () escribió:

> No I am not using JS capturing for any kind of actions. where as my other
> form button are working.
>
> On Thursday, June 14, 2018 at 2:14:48 AM UTC+5, Asif Khan wrote:
>>
>> I am having amazing problem in my django template. Button does not
>> respond on pressing click on it. It works when I press return key. code is
>> following.
>> {% extends 'vtapp/baseapp_layout.html' %}
>>
>> {% block head %}
>> Vehicle Vegilince - Customer Search
>> {% endblock %}
>>
>> {% block content %}
>> Enter Customer information
>> 
>> {% csrf_token %}
>> 
>> 
>> 
>> 
>> 
>> Search
>> 
>> 
>> 
>>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5f518cba-fcdc-4b2a-9f75-fad87b0e3cd0%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/5f518cba-fcdc-4b2a-9f75-fad87b0e3cd0%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN10d1-vfh38-DoEpQrp8Xegv70%3DZh25E%2BbtHQTP253xBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error while doing django tutorial part 2

2018-05-26 Thread Fidel Leon
Check your polls/models.py and verify you have the Question model like that:

class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')

Seems you are missing the question_text attribute.

El sáb., 26 may. 2018 a las 19:48, Kranthi Kiran (<1991.kran...@gmail.com>)
escribió:

> Text of error message in case the image is not loading
>
>
> >>> q = Question.objects.get(pk=1)
> >>> q.choice_set.all()
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib64/python3.6/site-packages/django/db/models/query.py",
> line 251,
> in __repr__
> return '<%s %r>' % (self.__class__.__name__, data)
>   File "/usr/lib64/python3.6/site-packages/django/db/models/base.py", line
> 513,
>   in __repr__
> return '<%s: %s>' % (self.__class__.__name__, self)
>   File "/home/kkondapalli/mysite/polls/models.py", line 25, in __str__
> return self.question_text
> AttributeError: 'Choice' object has no attribute 'question_text'
> >>>
>
>
>
> On Saturday, 26 May 2018 22:49:04 UTC+5:30, Kranthi Kiran wrote:
>>
>> Hello User,
>>
>> I am following django tutorial at
>> https://docs.djangoproject.com/en/2.0/intro/tutorial02/
>>
>> After modifying polls/models.py  and when running python3.6 manage.py
>> shell again
>>
>>
>> I am getting the following error at the following
>>
>> >>> q = Question.objects.get(pk=1)
>> # Display any choices from the related object set -- none so far.>>> 
>> q.choice_set.all()
>>
>>
>> Error screenshot
>>
>>
>>
>>
>> Please help me to resolve the issue at earliest
>>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0e27456c-eefa-4a1e-bf4f-a44d9e8dcad1%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/0e27456c-eefa-4a1e-bf4f-a44d9e8dcad1%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN16%3D605PRq4nN0KbD3KJY0HF%2BYgbzNigEKE0qHaczieGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Page not found (404).Please check i am unable to run server.It is showing error

2018-05-25 Thread Fidel Leon
You may not realize it, but that's how Django works.

>From your server log:
*[25/May/2018 22:44:15] "GET /polls/ HTTP/1.1" 200 166*

You tried to open http://127.0.0.1:8000/polls/ and it WORKED (status 200)

*[25/May/2018 22:44:18] "GET /polls/1/ HTTP/1.1" 200 461*

You tried to open http://127.0.0.1:8000/polls/1/ and it WORKED (status 200)

*Not Found: /*

You try to open http://127.0.0.1:8000/ and it DIDN'T work. The error
message says it CLEAR:

Using the URLconf defined in mysite.urls, Django tried these URL patterns,
> in this order:
>
>1. *polls/*
>
>
>1. *admin/*
>
> The empty path didn't match any of these.


You ONLY have urls for polls/ and admin/, and you're trying to open
http://127.0.0.1:8000/

You DON'T have an url which routes to "/", hence you get a 404.



El vie., 25 may. 2018 a las 19:19, Avitab Ayan Sarmah (<
avitabay...@gmail.com>) escribió:

> In my windoes powershell:
>
> PS C:\Users\AVITABAYAN\mysite> python manage.py runserver
> Performing system checks...
>
> System check identified no issues (0 silenced).
> May 25, 2018 - 22:42:50
> Django version 2.0.1, using settings 'mysite.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CTRL-BREAK.
> Not Found: /
> [25/May/2018 22:43:01] "GET / HTTP/1.1" 404 2027
> Not Found: /favicon.ico
> [25/May/2018 22:43:02] "GET /favicon.ico HTTP/1.1" 404 2078
> Not Found: /
> [25/May/2018 22:43:15] "GET / HTTP/1.1" 404 2027
> [25/May/2018 22:44:15] "GET /polls/ HTTP/1.1" 200 166
> [25/May/2018 22:44:15] "GET /static/polls/style.css HTTP/1.1" 304 0
> [25/May/2018 22:44:15] "GET /static/polls/images/background.gif HTTP/1.1"
> 304 0
> [25/May/2018 22:44:18] "GET /polls/1/ HTTP/1.1" 200 461
> Not Found: /
> [25/May/2018 22:44:27] "GET / HTTP/1.1" 404 2027
> Not Found: /
> [25/May/2018 22:45:01] "GET / HTTP/1.1" 404 2027
>
> In my server:
>
> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1:8000/
>
> Using the URLconf defined in mysite.urls, Django tried these URL
> patterns, in this order:
>
>1. polls/
>2. admin/
>
> The empty path didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/85ba21bf-3c98-4bbe-877f-716eff7b73d2%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/85ba21bf-3c98-4bbe-877f-716eff7b73d2%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN2dRs9M%2Bx4_VJ%3D5kvefO%2BS27R_MODPjt7YW-xywES3RtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Starting a poll

2018-05-25 Thread Fidel Leon
Actually, such 404 message is not Django's fault. Your browser is trying to
get the favicon.ico on its own for the browser's tab decorations. Such file
is not provided neither needed by Django.

If you try to open the server url using something like curl or httpie, you
won't see the "error".

Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92 

El día 25 de mayo de 2018 a las 3:43:19, James Farris (
jamesafar...@gmail.com) escrito:

> If you open the app once the server is started by going to 127.0.0.1:8000
> is it loading the website or are you getting a 404 error in the browser?
>
> I see the favicon 404 error all the time, but it doesn’t halt my site.
> It’s just django looking for a favicon. That shouldn’t break anything.
>
> Another 404 you might see is django looking for a robots.txt file. This is
> normal until you have these setup.
>
> On Thu, May 24, 2018 at 2:15 PM Jorge Gimeno <jlgimen...@gmail.com> wrote:
>
>>
>>
>> On Thu, May 24, 2018, 10:06 AM Caleb Bryson <cbryson...@gmail.com> wrote:
>>
>>> So I am follow the instructions on the django site to make a poll. I am
>>> at the current step where you run the server and everything went fine when
>>> i typed in the command. But now it is just there at saying "GET
>>> /favicon.ico HTTP/1.1" 404 1977 on the last command line. I was wondering
>>> should i wait, or close the cmd prompt and open a new one to continue the
>>> steps, or quit the server with CTRL-BREAK(not sure which button represents
>>> break on the key board)?
>>>
>>> --
>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/e500ed8f-e5b4-4d3b-aced-29f33dfeb7ec%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/e500ed8f-e5b4-4d3b-aced-29f33dfeb7ec%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout
>>
>>
>>
>> Caleb,
>>
>> If I recall correctly, Ctrl-C stops the server.  Django dpes know when
>> some changes are made, but unless I know for sure I always stop and restart
>> the server.
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CANfN%3DK80LL-H3hETKcKMv8yLajgONuz4zKTFeJujS9VH0wZQJg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CANfN%3DK80LL-H3hETKcKMv8yLajgONuz4zKTFeJujS9VH0wZQJg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAE-E-_2xmTM3o4z8f5i26o7hLH8T_cRYKb1GMSsNvHFkK7_Kdg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAE-E-_2xmTM3o4z8f5i26o7hLH8T_cRYKb1GMSsNvHFkK7_Kdg%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN31k_T19V5Qz%3D5EfMueLDCFF9DvSbFFacB%3D9LrCY%2BrOhg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: MySQL caching_sha2_password

2018-05-19 Thread Fidel Leon
You my want to check:
https://stackoverflow.com/questions/50416391/caching-sha2-password-plugin-failing-on-windows

Basically, you’d need to install Oracle MySQL’s official Python connector.

Besides, you have posted a server database configuration, including an IP
and a port that are 100% *reachable from the Internet*:

MySQL Error 1045 (28000): Access denied for user 'root'@'92.187.87.65'
(using password: YES)

Not the best idea...

Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92 
GPG: 2585 30C2 E3C7 7151 0864  946B 7423 F94B 5753 5FC7

El 19 de mayo de 2018 a las 0:04:32, Kadir Guloglu (kadirgulog...@gmail.com)
escribió:

Hi

I am connect to MySQL database and I am getting this exception

Thanks for help



DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'host': '78.135.79.26',
'database': 'otomabakdb',
'user': 'otomabakus',
'password': 'password1',
'port': 3306,
}
}






Traceback (most recent call last):
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py",
line 216, in ensure_connection
self.connect()
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py",
line 194, in connect
self.connection = self.get_new_connection(conn_params)
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\base.py",
line 236, in get_new_connection
return Database.connect(**conn_params)
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\MySQLdb\__init__.py",
line 86, in Connect
return Connection(*args, **kwargs)
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\MySQLdb\connections.py",
line 204, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2059, "Authentication plugin
'caching_sha2_password' cannot be loaded: The specified module could not be
found.\r\n")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 15, in 
execute_from_command_line(sys.argv)
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py",
line 371, in execute_from_command_line
utility.execute()
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py",
line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
line 288, in run_from_argv
self.execute(*args, **cmd_options)
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
line 332, in execute
self.check()
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
line 364, in check
include_deployment_checks=include_deployment_checks,
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\migrate.py",
line 57, in _run_checks
issues = run_checks(tags=[Tags.database])
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py",
line 73, in run_checks
new_errors = check(app_configs=app_configs)
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\database.py",
line 10, in check_database_backends
issues.extend(conn.validation.check(**kwargs))
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\validation.py",
line 9, in check
issues.extend(self._check_sql_mode(**kwargs))
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\validation.py",
line 13, in _check_sql_mode
with self.connection.cursor() as cursor:
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py",
line 255, in cursor
return self._cursor()
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py",
line 232, in _cursor
self.ensure_connection()
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py",
line 216, in ensure_connection
self.connect()
  File
"C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\utils.py",
line 89, in __exit__
raise dj_exc_value.with_traceback

Re: ImportError : cannot import name include

2018-05-18 Thread Fidel Leon
You need to follow the CORRECT tutorial:

https://docs.djangoproject.com/en/1.11/

In the urls.py file, instead of:

from django.contrib import adminfrom django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),]

you need this:

from django.conf.urls import include, urlfrom django.contrib import admin
urlpatterns = [
url(r'^polls/', include('polls.urls')),
url(r'^admin/', admin.site.urls),]

Please note the django.conf.urls INSTEAD of django.contrib


El vie., 18 may. 2018 a las 16:20, Journal-Immo (<cont...@journal-immo.com>)
escribió:

> Thank
>
> But (I use debian 9)
>
> Apt-get update
>
> Apt-get install python python3 python-django
>
> django-admin --version 1.11.13
>
> Where is the problem ?
>
> Le 17/05/2018 à 21:01, Fidel Leon a écrit :
>
> You are using the wrong combination of Django and tutorial: “include” is
> available in Django 2 and up, but you’re using Django 1.11.
>
> Fidel Leon
> fi...@flm.cat
> Phone: +34 622 26 44 92 
> GPG: 2585 30C2 E3C7 7151 0864  946B 7423 F94B 5753 5FC7
>
> El 17 de mayo de 2018 a las 20:56:56, Tristan Demot (
> cont...@journal-immo.com) escribió:
>
> Hello,
>
>  I use docs.djangoproject.co/en/2.0
>  Python 2 7 13
> Gjango 1.11.13
>
> Creating the Polls app OK
> Write your first view OK
> But python manage runserver don't work
> With : python -Wall manage.py test
> ImportError : cannot import name include
> If you want to see something, ask me
> Many 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1fe7df04-dc85-4a3d-940e-4dde7de31477%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/1fe7df04-dc85-4a3d-940e-4dde7de31477%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHXg%3DN090U8JCFfdvZJWH1qSoWQgp2mQH6z2RfCzj3384epQKQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHXg%3DN090U8JCFfdvZJWH1qSoWQgp2mQH6z2RfCzj3384epQKQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN3nMbGtHLjQO2WoJgr8rjFwO7L5Sm-MRduf4yEPpfH7EA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ImportError : cannot import name include

2018-05-17 Thread Fidel Leon
You are using the wrong combination of Django and tutorial: “include” is
available in Django 2 and up, but you’re using Django 1.11.

Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92 
GPG: 2585 30C2 E3C7 7151 0864  946B 7423 F94B 5753 5FC7

El 17 de mayo de 2018 a las 20:56:56, Tristan Demot (
cont...@journal-immo.com) escribió:

Hello,

 I use docs.djangoproject.co/en/2.0
 Python 2 7 13
Gjango 1.11.13

Creating the Polls app OK
Write your first view OK
But python manage runserver don't work
With : python -Wall manage.py test

ImportError : cannot import name include

If you want to see something, ask me

Many 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/1fe7df04-dc85-4a3d-940e-4dde7de31477%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/1fe7df04-dc85-4a3d-940e-4dde7de31477%40googlegroups.com?utm_medium=email_source=footer>
.
For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN090U8JCFfdvZJWH1qSoWQgp2mQH6z2RfCzj3384epQKQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to operate with two models in one view

2018-05-15 Thread Fidel Leon
When you are using models related by a Foreign Key, by default you have
access to the "children" models from the parent model. For example, your
Sensor model gets a "measurment_set" property just because of such foreign
key:

>>> dir(Sensor.objects.all()[0])
>
> [other properties, '*measurment_set*', [more properties]
>
>
>
which means you can access your measurements from a Sensor model:

>>> sensor = Sensor.objects.all()[0]
> >>> sensor
> 
> >>> sensor.measurment_set.all()
> ,
> ]>
>

You can change the default name in the ForeignKey field declaration, using
the *related_name* parameter.

You can also access the children from the templates:

Sensors List
>
> {% if sensors_list %}
>
> 
>
>   
>
> ID sens
>
> Date of install
>
> Latitude
>
> Longitude
>
> Data from last measurments
>
>   
>
>   {% for sensor in sensors_list %}
>
>   
>
> {{sensor.id}}
>
> {{sensor.date_start}}
>
>{{sensor.Latitude}}
>
> {{sensor.Longitude}}
>
> {% *with sensor.measurment_set.all.0 as last_measurment* %}
>
> {{ last_measurment.temperature1 }}{{
>> last_measurment.temperature2 }}{{ last_measurment.temperature3
>> }}
>
> {% endwith %}
>
>   
>
>   {% endfor %}
>
> 
>
> {% else %}
>
>   There are no sensors in the DB.
>
> {% endif %}
>
>
Using *with* limits your children to a single item, and telling the
template *all.0* you refer to the FIRST measurement for such sensor. The
only thing you need to do is tell the Measurment model to list itself by
time_of_measurment *reversed*, so the "first" object in the list will be
the latest measurement:


> class Measurment(models.Model):
> 
> class Meta:
> ordering = ['-time_of_measurment',]


The way I have done it is a bit hacky (and I guess there are cleaner ways
to do it, using get_context or similars), but hey!


El mar., 15 may. 2018 a las 13:21, Anton Smirnov (<
antonsmirnov1...@gmail.com>) escribió:

> There are two models "Sensors" with information about them and
> "Measurments" .
>
> class Sensor(models.Model):
> date_start = models.DateField()
> Latitude =  models.DecimalField(max_digits=18, decimal_places=15)
> Longitude = models.DecimalField(max_digits=18, decimal_places=15)
>
> def __str__(self):
> return 'id:%s / %s' % (self.id, self.date_start)
> class Measurment(models.Model):
> sens = models.ForeignKey(Sensor, on_delete=models.PROTECT)
> time_of_measurment = models.DateTimeField()
> humidity = models.PositiveSmallIntegerField()
> temperature1 = models.DecimalField(max_digits=5, decimal_places=2)
> temperature2 = models.DecimalField(max_digits=5, decimal_places=2)
> temperature3 = models.DecimalField(max_digits=5, decimal_places=2)
>
> def __str__(self):
> return 'sens_id:%s, time:%s' % (self.sens.id, self.time_of_measurment)
>
> From each sensor I serially recive measurments. On the page, it is
> necessary to display the sensor data and the latest measurement data from
> the "Measurments" model corresponding for each sensor.
>
> for displaying data about sensor I used ListView:
>
> view:
>
> from .models import Sensor, Measurmentclass SenorsListView(generic.ListView):
> model = Sensor, Measurment
> context_object_name = 'sensors_list'
> template_name = 'sensors_list.html'
> queryset = Sensor.objects.all().order_by('-date_start')
>
> template "sensors_list.html":
>
> {% extends "base_generic.html" %}{% block content %}
> Sensors List
> {% if sensors_list %}
> 
>   
> ID sens
> Date of install
> Latitude
> Longitude
> Data from last measurments
>   
>   {% for sensor in sensors_list %}
>   
> {{sensor.id}}
> {{sensor.date_start}}
>{{sensor.Latitude}}
> {{sensor.Longitude}}
> {{}}
>   
>   {% endfor %}
> 
> {% else %}
>   There are no sensors in the DB.
> {% endif %} {% endblock %}
>
> But dont know How to display data about last measurments. I think need
> using aggregate to calculate max of time_of_measurment for each id_sens.
>
> How it can be done?
>
> --
> 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.
>

Re: importError

2018-05-04 Thread Fidel Leon
>From the look of things, it seems:
-You're following the Django v2.0 tutorial.
-You have installed a Django v1 version.

This is an example with Django v2:

>>> import django
>>> django.get_version()
*'2.0.5' *
>>> from django.urls import include, path
>>>
*[No error]*

And this is an example with Django v1.11

>>> from django import get_version
>>> get_version()
*'1.11.13' *
>>> from django.urls import include, urls
Traceback (most recent call last):
 File "", line 1, in 
*ImportError: cannot import name 'include'*
>>>

So either you upgrade your Django package, or you follow your Django
version's tutorial :)


El vie., 4 may. 2018 a las 15:12, <gkfka5...@ajou.ac.kr> escribió:

> I run 'python manage.py runserver'.
> but this message appear.
>
> Traceback (most recent call last):
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\utils\autoreload.py",
> l
> ine 228, in wrapper
> fn(*args, **kwargs)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\management\command
> s\runserver.py", line 124, in inner_run
> self.check(display_num_errors=True)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\management\base.py
> ", line 359, in check
> include_deployment_checks=include_deployment_checks,
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\management\base.py
> ", line 346, in _run_checks
> return checks.run_checks(**kwargs)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\checks\registry.py
> ", line 81, in run_checks
> new_errors = check(app_configs=app_configs)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\checks\urls.py",
> l
> ine 16, in check_url_config
> return check_resolver(resolver)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\checks\urls.py",
> l
> ine 26, in check_resolver
> return check_method()
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\urls\resolvers.py",
> lin
> e 254, in check
> for pattern in self.url_patterns:
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\utils\functional.py",
> l
> ine 35, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\urls\resolvers.py",
> lin
> e 405, in url_patterns
> patterns = getattr(self.urlconf_module, "urlpatterns",
> self.urlconf_module)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\utils\functional.py",
> l
> ine 35, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\urls\resolvers.py",
> lin
> e 398, in urlconf_module
> return import_module(self.urlconf_name)
>   File "c:\Python27\Lib\importlib\__init__.py", line 37, in import_module
> __import__(name)
>   File "C:\Users\gkfka\PycharmProjects\django\cafe\mysite\mysite\urls.py",
> line 17, in 
> from django.urls import include, path
> ImportError: cannot import name include
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e9634a2e-8970-4f14-bb2b-1275ce305fad%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e9634a2e-8970-4f14-bb2b-1275ce305fad%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN1JFHZBryqHtMM0DbBf5Q9XyG6h%2BAJmFAmH7UbWU8jPjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site and Model

2018-05-04 Thread Fidel Leon
May we see your admin.py?

El vie., 4 may. 2018 a las 8:32, Harish Soni (<hk220...@gmail.com>)
escribió:

> Hi All,
> whenever I create a new model(table) and migrate. I can see it is
> available in mysql but its not showing in admin. I have to delete my db and
> make migrations of all the tables again to make that table show in admin.
>  any help would be appreciate.
>
> Regards
> Harish Soni Swarnkar
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMOFmommxT%3DCLjabwVo0T5ubJ-z8GhN8xwbCXMFcEHXpjR4DEw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMOFmommxT%3DCLjabwVo0T5ubJ-z8GhN8xwbCXMFcEHXpjR4DEw%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN2Le%2BO1jRE7ELTOs1UTy75azLAoe6oqXeLzMFTrF2bC4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site and Model

2018-05-04 Thread Fidel Leon
You need to add your model to the app's admin.py file.

As an example:
https://docs.djangoproject.com/en/2.0/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin

El vie., 4 may. 2018 a las 8:32, Harish Soni (<hk220...@gmail.com>)
escribió:

> Hi All,
> whenever I create a new model(table) and migrate. I can see it is
> available in mysql but its not showing in admin. I have to delete my db and
> make migrations of all the tables again to make that table show in admin.
>  any help would be appreciate.
>
> Regards
> Harish Soni Swarnkar
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMOFmommxT%3DCLjabwVo0T5ubJ-z8GhN8xwbCXMFcEHXpjR4DEw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMOFmommxT%3DCLjabwVo0T5ubJ-z8GhN8xwbCXMFcEHXpjR4DEw%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN0GgESWXjOhJHjvdMnT0UGOY5usryLGGc_nNujWJOoPfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" th

2018-05-03 Thread Fidel Leon
Sure:

from django.http import HttpResponse

from .models import Question


def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
output = ', '.join([q.question_text for q in latest_question_list])
return HttpResponse(output)

def detail(request, question_id):
return HttpResponse("You're looking at question %s." % question_id)

def results(request, question_id):
response = "You're looking at the results of question %s."
return HttpResponse(response % question_id)

def vote(request, question_id):
return HttpResponse("You're voting on question %s." % question_id)

As a matter of advice, please use a fixed-width font when pasting code,
because Python is indented with spaces and using any other type of font
makes reading your mail difficult :)

El jue., 3 may. 2018 a las 18:08, Avitab Ayan Sarmah (<avitabay...@gmail.com>)
escribió:

> hello Fidel Leon can you please rewrite the whole views.py code so that i
> can understand what is the exact code is
>
> On Thu, May 3, 2018 at 9:19 PM, Fidel Leon <fi...@flm.cat> wrote:
>
>>
>>
>> El jue., 3 may. 2018 a las 17:38, Avitab Ayan Sarmah (<
>> avitabay...@gmail.com>) escribió:
>>
>>>
>>> *polls/views.py*:
>>>
>>> from django.http import HttpResponse
>>> from django.template import loader
>>>
>>> from . models import Question
>>>
>>> def index(request):
>>> return HttpResponse("Hello, world.You're at the polls index.")
>>> latest_question_list = Question.objects.order_by('-pub_date')[:5]
>>> output = ', '.join([q.question_text for q in latest_question_list])
>>> return HttpResponse(output)
>>> latest_question_list = Question.objects.order_by('-pub_date')[:5]
>>> template = loader.get_template('polls/index.html')
>>> context = {
>>> 'latest_question_list': latest_question_list,
>>> }
>>> return HttpResponse(template.render(context, request))
>>>
>>>
>> Your function index(request) inside polls/views.py is badly written (you
>> have three function returns). Seems you are following the tutorial but not
>> removing the previous examples:
>>
>> def index(request):
>> latest_question_list = Question.objects.order_by('-pub_date')[:5]
>> context = {'latest_question_list': latest_question_list}
>> return render(request, 'polls/index.html', context)
>>
>> --
>> Fidel Leon
>> fi...@flm.cat
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/5hvN4Lfds-w/unsubscribe.
>> To unsubscribe from this group and all its topics, 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHXg%3DN2SNuyAsAzk7mYfBB5rahtD3fRSa4vTbL92BQf5CHg-Nw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAHXg%3DN2SNuyAsAzk7mYfBB5rahtD3fRSa4vTbL92BQf5CHg-Nw%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEx5wm7VMMa3C2%3DyWA%3DQu%3DhihJiWujwvoA59Xx4ru59Zdc0UVg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEx5wm7VMMa3C2%3DyWA%3DQu%3DhihJiWujwvoA59Xx4ru59Zdc0UVg%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN3-8kKboqLD8cFRympuLvtTgj0uh6BxbfMr8FtfyNEojA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Fidel Leon
As part of its protection, Comodo Antivirus has something named
“sandboxing”, so when you execute anything, Comodo catches it, runs it
inside a protected environment and if it finds it’s not malware, runs the
actual command.

Seems Comodo is mapping your D: drive to that C:\VTRoot\HarddiskVolume1
thing, so django-admin gets fooled.

I haven’t used Comodo for decades so I can’t help with this exact issue,
sorry - maybe disabling the antivirus while you’re at Django? O:-)

Fidel Leon
fi...@flm.cat


El 3 de mayo de 2018 a las 18:19:06, Duška Miloradović (
daisyfields...@gmail.com) escribió:

Yes? :/

On Thu, May 3, 2018 at 6:09 PM, Fidel Leon <fi...@flm.cat> wrote:

> Are you using Comodo Antivirus?
>
> https://forums.malwarebytes.com/topic/181573-cvtroot/
>
>
>
> El jue., 3 may. 2018 a las 18:06, Duška Miloradović (<
> daisyfields...@gmail.com>) escribió:
>
>> Anthony, I got this:
>>
>> D:\projectdir>python create_dir.py
>> Traceback (most recent call last):
>>   File "create_dir.py", line 2, in 
>> top_dir = path.join(os.getcwd(), 'python_created_me')
>> NameError: name 'path' is not defined
>>
>> I searched for it through windows explorer again and I actually *found
>> it* on this strange location: C:\VTRoot\HarddiskVolume1\projectdir\mysite
>> Do you have any clue how this happened?
>> How to make things right? :)
>>
>> On Thu, May 3, 2018 at 5:08 PM, Anthony Flury <
>> anthony.fl...@btinternet.com> wrote:
>>
>>> On 03/05/18 08:06, Anthony Flury wrote:
>>>
>>>> On Thursday, 03 May, 2018 03:25 PM, Daisy wrote:
>>>>
>>>> I tried what you suggested and got this:
>>>> D:\projectdir>python create_dir.py
>>>> Traceback (most recent call last):
>>>>   File "create_dir.py", line 1, in 
>>>> from os import mkdirs
>>>> ImportError: cannot import name 'mkdirs'
>>>>
>>>> Sorry - that should be :
>>>
>>> import os
>>> top_dir = path.join(os.getcwd(), 'python_created_me')
>>> os.makedirs(top_dir)
>>>
>>>>
>>>> Copy that to a python file called '*create_dir.py*' in your
>>>> *projectdir* - and run it by this command '*python create_dir.py*'
>>>>
>>>> One you run it you should have a new empty directory called
>>>> 'python_created_me' - running the comand again should result in an error.
>>>>
>>>> The reason for doing this is to check that the Python code that Django
>>>> is using does work ok.
>>>>
>>>> The other thing you could do is to use the File Manager search to see
>>> if 'my_site' has been created else where on your system
>>>
>>>
>>> --
>>> --
>>> Anthony Flury
>>> email : *anthony.fl...@btinternet.com*
>>> Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*
>>>
>>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/CAJ0SFUA52autPYk95a9s4t%2BHXzdx-OYgj%3DzLyfynYX9XiM%
>> 3D6NQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAJ0SFUA52autPYk95a9s4t%2BHXzdx-OYgj%3DzLyfynYX9XiM%3D6NQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Fidel Leon
> fi...@flm.cat
> Phone: +34 622 26 44 92
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAHXg%3DN3rH--NCcJ9TLbLJsjtVv0%
> 3D0KoJLh5x01W%2BmrhzNz0oJw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHXg%3DN3rH--NCcJ9TLbLJsjtVv0%3D0KoJLh5x01W%2BmrhzNz0oJw%40mail.gmail.com?utm_medium=email_source=footer>.
>
>
> For more

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Fidel Leon
Are you using Comodo Antivirus?

https://forums.malwarebytes.com/topic/181573-cvtroot/



El jue., 3 may. 2018 a las 18:06, Duška Miloradović (<
daisyfields...@gmail.com>) escribió:

> Anthony, I got this:
>
> D:\projectdir>python create_dir.py
> Traceback (most recent call last):
>   File "create_dir.py", line 2, in 
> top_dir = path.join(os.getcwd(), 'python_created_me')
> NameError: name 'path' is not defined
>
> I searched for it through windows explorer again and I actually *found it*
> on this strange location: C:\VTRoot\HarddiskVolume1\projectdir\mysite
> Do you have any clue how this happened?
> How to make things right? :)
>
> On Thu, May 3, 2018 at 5:08 PM, Anthony Flury <
> anthony.fl...@btinternet.com> wrote:
>
>> On 03/05/18 08:06, Anthony Flury wrote:
>>
>>> On Thursday, 03 May, 2018 03:25 PM, Daisy wrote:
>>>
>>> I tried what you suggested and got this:
>>> D:\projectdir>python create_dir.py
>>> Traceback (most recent call last):
>>>   File "create_dir.py", line 1, in 
>>> from os import mkdirs
>>> ImportError: cannot import name 'mkdirs'
>>>
>>> Sorry - that should be :
>>
>> import os
>> top_dir = path.join(os.getcwd(), 'python_created_me')
>> os.makedirs(top_dir)
>>
>>>
>>> Copy that to a python file called '*create_dir.py*' in your *projectdir*
>>> - and run it by this command '*python create_dir.py*'
>>>
>>> One you run it you should have a new empty directory called
>>> 'python_created_me' - running the comand again should result in an error.
>>>
>>> The reason for doing this is to check that the Python code that Django
>>> is using does work ok.
>>>
>>> The other thing you could do is to use the File Manager search to see if
>> 'my_site' has been created else where on your system
>>
>>
>> --
>> --
>> Anthony Flury
>> email : *anthony.fl...@btinternet.com*
>> Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*
>>
>>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJ0SFUA52autPYk95a9s4t%2BHXzdx-OYgj%3DzLyfynYX9XiM%3D6NQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJ0SFUA52autPYk95a9s4t%2BHXzdx-OYgj%3DzLyfynYX9XiM%3D6NQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN3rH--NCcJ9TLbLJsjtVv0%3D0KoJLh5x01W%2BmrhzNz0oJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Fidel Leon
gt; For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>>> --
>>>> --
>>>> Anthony Flury
>>>>
>>> email : *anthon...@btinternet.com*
>>>>
>>> Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*
>>>>
>>>> --
>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/c93769b1-55ca-47f7-9f8f-474ab07ede88%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/c93769b1-55ca-47f7-9f8f-474ab07ede88%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAE0AZGKfOqYa3bpFi5LYXQgRNP1yxus22gWfamXR8GYBxfyZrA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAE0AZGKfOqYa3bpFi5LYXQgRNP1yxus22gWfamXR8GYBxfyZrA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJ0SFUA2nNGaifTYhsJDWoTZ9cwwHJbGWbDPG46K6tbSfD8ObA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJ0SFUA2nNGaifTYhsJDWoTZ9cwwHJbGWbDPG46K6tbSfD8ObA%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN1AXasBscZqErxUpdCKNF9kGK0sb4sApX2ZEUbT2L_X8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" th

2018-05-03 Thread Fidel Leon
El jue., 3 may. 2018 a las 17:38, Avitab Ayan Sarmah (<avitabay...@gmail.com>)
escribió:

>
> *polls/views.py*:
>
> from django.http import HttpResponse
> from django.template import loader
>
> from . models import Question
>
> def index(request):
> return HttpResponse("Hello, world.You're at the polls index.")
> latest_question_list = Question.objects.order_by('-pub_date')[:5]
> output = ', '.join([q.question_text for q in latest_question_list])
> return HttpResponse(output)
> latest_question_list = Question.objects.order_by('-pub_date')[:5]
> template = loader.get_template('polls/index.html')
> context = {
> 'latest_question_list': latest_question_list,
> }
> return HttpResponse(template.render(context, request))
>
>
Your function index(request) inside polls/views.py is badly written (you
have three function returns). Seems you are following the tutorial but not
removing the previous examples:

def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
context = {'latest_question_list': latest_question_list}
return render(request, 'polls/index.html', context)

-- 
Fidel Leon
fi...@flm.cat

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXg%3DN2SNuyAsAzk7mYfBB5rahtD3fRSa4vTbL92BQf5CHg-Nw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial 1 doesn't work

2018-04-28 Thread Fidel Leon
Line 6 of polls/views, should be:

def index(request):

instead of

def index*[*request*]*:

Python function names get arguments using parenthesis, not square brackets.

Fidel Leon


El 28 de abril de 2018 a las 13:54:13, giwon@nexstreaming.com (
giwon@nexstreaming.com) escribió:

I did exactly what is written in the tutorial 1 and checked it many times,
and I got the server up and running and I had this log.

The funny thing is that I don't have this log and it starts running the
server successfully if I get rid of the path setting in the mysite/urls.py


I think I'm having this issue because of the 'include' statement in this
script.



from django.contrib import admin

from django.urls import include, path


urlpatterns = [

path('polls/', include('polls.urls')),

path('admin/', admin.site.urls),

]

Has anyone had this issue?





Unhandled exception in thread started by .wrapper at 0x104061488>

Traceback (most recent call last):

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/utils/autoreload.py",
line 225, in wrapper

fn(*args, **kwargs)

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
line 120, in inner_run

self.check(display_num_errors=True)

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/core/management/base.py",
line 364, in check

include_deployment_checks=include_deployment_checks,

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/core/management/base.py",
line 351, in _run_checks

return checks.run_checks(**kwargs)

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/core/checks/registry.py",
line 73, in run_checks

new_errors = check(app_configs=app_configs)

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/core/checks/urls.py",
line 13, in check_url_config

return check_resolver(resolver)

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/core/checks/urls.py",
line 23, in check_resolver

return check_method()

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/urls/resolvers.py",
line 397, in check

for pattern in self.url_patterns:

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/utils/functional.py",
line 36, in __get__

res = instance.__dict__[self.name] = self.func(instance)

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/urls/resolvers.py",
line 536, in url_patterns

patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/utils/functional.py",
line 36, in __get__

res = instance.__dict__[self.name] = self.func(instance)

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/urls/resolvers.py",
line 529, in urlconf_module

return import_module(self.urlconf_name)

  File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py",
line 126, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

  File "", line 994, in _gcd_import

  File "", line 971, in _find_and_load

  File "", line 955, in _find_and_load_unlocked

  File "", line 665, in _load_unlocked

  File "", line 678, in exec_module

  File "", line 219, in
_call_with_frames_removed

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/mysite/mysite/urls.py",
line 20, in 

path('polls/', include('polls.urls')),

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/urls/conf.py",
line 34, in include

urlconf_module = import_module(urlconf_module)

  File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py",
line 126, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

  File "", line 994, in _gcd_import

  File "", line 971, in _find_and_load

  File "", line 955, in _find_and_load_unlocked

  File "", line 665, in _load_unlocked

  File "", line 678, in exec_module

  File "", line 219, in
_call_with_frames_removed

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/mysite/polls/urls.py", line
3, in 

from . import views

  File
"/Users/seogiwon/pythonDocuments/djangoTutorial/mysite/polls/views.py&quo