Problems with "Class Meta" and " __str__"

2019-09-10 Thread Elmaco7
Hello, I do these models but the Django admin page doesn't read the "class 
Meta" and " __str__".
This is the models.py document





























*from django.db import models# Create your models here.class 
Autore(models.Model):nome = models.CharField(max_length=50)cognome 
= models.CharField(max_length=50)def __str__(self):return 
self.autore_textclass Meta:verbose_name_plural = "Autori"class 
Genere(models.Model):descrizione = models.CharField(max_length=30)def 
__str__(self):return self.genere_textclass Meta:
verbose_name_plural = "Generi"class Libro(models.Model):titolo = 
models.CharField(max_length=200)autore = models.ForeignKey(Autore, 
on_delete=models.CASCADE)genere = models.ForeignKey(Genere, 
on_delete=models.CASCADE)def __str__(self):return 
self.libro_textclass Meta:verbose_name_plural = "Libri"*


These are the results




Can someone help me?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c1941b52-7d2b-4b09-8ead-fce630b73757%40googlegroups.com.


Postgre sql problem

2019-09-06 Thread Elmaco7
*Hello, I'm trying to use Postresql with my django project, but when i try 
to install psycopg2(with this command 'pip3 install psycopg2')  this 
problem appears:*

Collecting psycopg2
  Using cached 
https://files.pythonhosted.org/packages/5c/1c/6997288da181277a0c29bc39a5f9143ff20b8c99f2a7d059cfb55163e165/psycopg2-2.8.3.tar.gz
Building wheels for collected packages: psycopg2
  Building wheel for psycopg2 (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/user/myproject/myprojectenv/bin/python3 -u -c 'import 
sys, setuptools, tokenize; sys.argv[0] = 
'"'"'/tmp/pip-install-t391_oat/psycopg2/setup.py'"'"'; 
__file__='"'"'/tmp/pip-install-t391_oat/psycopg2/setup.py'"'"';f=getattr(tokenize,
 
'"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' 
bdist_wheel -d /tmp/pip-wheel-mkc6kj2i --python-tag cp36
   cwd: /tmp/pip-install-t391_oat/psycopg2/
  Complete output (40 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/psycopg2
  copying lib/pool.py -> build/lib.linux-x86_64-3.6/psycopg2
  copying lib/_range.py -> build/lib.linux-x86_64-3.6/psycopg2
  copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.6/psycopg2
  copying lib/sql.py -> build/lib.linux-x86_64-3.6/psycopg2
  copying lib/extensions.py -> build/lib.linux-x86_64-3.6/psycopg2
  copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.6/psycopg2
  copying lib/errorcodes.py -> build/lib.linux-x86_64-3.6/psycopg2
  copying lib/tz.py -> build/lib.linux-x86_64-3.6/psycopg2
  copying lib/extras.py -> build/lib.linux-x86_64-3.6/psycopg2
  copying lib/_json.py -> build/lib.linux-x86_64-3.6/psycopg2
  copying lib/errors.py -> build/lib.linux-x86_64-3.6/psycopg2
  copying lib/compat.py -> build/lib.linux-x86_64-3.6/psycopg2
  copying lib/__init__.py -> build/lib.linux-x86_64-3.6/psycopg2
  running build_ext
  building 'psycopg2._psycopg' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/psycopg
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g 
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
-D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.8.3 (dt dec pq3 ext lo64) 
-DPG_VERSION_NUM=100010 -DHAVE_LO64=1 -I/usr/include/python3.6m 
-I/home/user/myproject/myprojectenv/include/python3.6m -I. 
-I/usr/include/postgresql -I/usr/include/postgresql/10/server -c 
psycopg/psycopgmodule.c -o 
build/temp.linux-x86_64-3.6/psycopg/psycopgmodule.o 
-Wdeclaration-after-statement
  In file included from psycopg/psycopgmodule.c:27:0:
  ./psycopg/psycopg.h:34:10: fatal error: Python.h: No such file or 
directory
   #include 
^~
  compilation terminated.
  
  It appears you are missing some prerequisite to build the package from 
source.
  
  You may install a binary package by installing 'psycopg2-binary' from 
PyPI.
  If you want to install psycopg2 from source, please install the packages
  required for the build and try again.
  
  For further information please check the 'doc/src/install.rst' file (also 
at
  ).
  
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ERROR: Failed building wheel for psycopg2
  Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2
  Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
 command: /home/user/myproject/myprojectenv/bin/python3 -u -c 'import 
sys, setuptools, tokenize; sys.argv[0] = 
'"'"'/tmp/pip-install-t391_oat/psycopg2/setup.py'"'"'; 
__file__='"'"'/tmp/pip-install-t391_oat/psycopg2/setup.py'"'"';f=getattr(tokenize,
 
'"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' 
install --record /tmp/pip-record-bl1kkv0m/install-record.txt 
--single-version-externally-managed --compile --install-headers 
/home/user/myproject/myprojectenv/include/site/python3.6/psycopg2
 cwd: /tmp/pip-install-t391_oat/psycopg2/
Complete output (40 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.6/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.6/psycopg2
copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.6/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.6/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.6/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.6/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.6/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.6/psycopg2
  

Help with Django

2019-09-01 Thread Elmaco7
Hello, I'm new and it's the first time that I use Django.
I should create a site with a database containing Students, exams and 
grades.
Furthermore I should give the possibility to insert a student and to know 
how many exams he has given and also to insert an exam and know which 
students have passed it.
Can someone help me?
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8858e1b6-0448-43da-a495-5e314cf5b220%40googlegroups.com.