Re: Deploying a Django 1.9 project

2016-07-07 Thread ofeyofey
Hi, I also am trying to deploy Django 1.9 to Bluehost shared hosting, but with Python 2.7. As the server is Apache I should be using mod_wsgi but that requires access to httpd.config which Bluehost does not allow . FastCGI is not supported by Django 1.9

Django send_mail smtp gmail

2016-05-18 Thread ofeyofey
Hi, I have set up smtp with a gmail account. When I use send_mail the from email is not showing up in the account receiving the email. Django settings.py # DEFAULT_FROM_EMAIL = 'sen...@gmail.com' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_P

Re: Querying a model with a ForeignKey

2016-05-09 Thread ofeyofey
This also grabs the frequency or number of views per post. On Tuesday, 3 May 2016 18:43:53 UTC+1, ofeyofey wrote: > > I have two tables in a sqlite3 DB, PostModel and TopicModel. The PostModel > has fields id, post, author, pub_date and topicid. This last fields topicid > has a f

Re: Querying a model with a ForeignKey

2016-05-09 Thread ofeyofey
Hi, Just in case it is useful to anyone, here is the solution, > > pModel = PostModel.objects.raw('SELECT *, max(pub_date), count(topicid_id) > AS freq FROM crudapp_postmodel GROUP BY topicid_id ORDER BY pub_date DESC > LIMIT 0,20') Thanks On Tuesday, 3 May 2016 18

Re: Querying a model with a ForeignKey

2016-05-03 Thread ofeyofey
No problem. I will post if i figure it out. Thanks very much for your help On Tuesday, 3 May 2016 18:43:53 UTC+1, ofeyofey wrote: > > I have two tables in a sqlite3 DB, PostModel and TopicModel. The PostModel > has fields id, post, author, pub_date and topicid. This last fields topicid

Re: Querying a model with a ForeignKey

2016-05-03 Thread ofeyofey
7;-pub_date')[0]) # context = {'tModel': tModel, 'pModel': pModel} context = {'pModel': pModel} return render(request, 'forum.html', context) Thanks again, On Tuesday, 3 May 2016 18:43:53 UTC+1, ofeyofey wrote: > > I have two tables in a sqlite3

Querying a model with a ForeignKey

2016-05-03 Thread ofeyofey
I have two tables in a sqlite3 DB, PostModel and TopicModel. The PostModel has fields id, post, author, pub_date and topicid. This last fields topicid has a foreignkey to the other table Postmodel. PostModel has the fields id, topic. There is a one-to-many relation from the TopicModel to the Pos

Re: Adding a field to a model after initial migration

2016-01-27 Thread ofeyofey
Alas too late... I have dropped the table. But this link http://www.djangobook.com/en/2.0/chapter10.html to a Django Book for version 1.0 may hold some ideas under the section about adding fields. Thanks On Wednesday, 27 January 2016 19:21:16 UTC, ofeyofey wrote: > > Hi, > I forgot

Re: Adding a field to a model after initial migration

2016-01-27 Thread ofeyofey
No problem. Thanks for your help. Maybe fields can't be added to a model with django. I will try dropping the table in the DB and see what happens. Thanks again, On Wednesday, 27 January 2016 19:21:16 UTC, ofeyofey wrote: > > Hi, > I forgot to add a field to a model and wish to a

Re: Adding a field to a model after initial migration

2016-01-27 Thread ofeyofey
Ok I put the app name which is 'news' after the commands for makemigrations and for migrate. But I am still getting the same results. On Wednesday, 27 January 2016 19:21:16 UTC, ofeyofey wrote: > > Hi, > I forgot to add a field to a model and wish to add it now. > I added

Re: Adding a field to a model after initial migration

2016-01-27 Thread ofeyofey
. File "/usr/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 1399, in to_python parsed = parse_datetime(value) File "/usr/lib/python2.7/site-packages/django/utils/dateparse.py", line 93 , in parse_datetime match = datetime_re.match(value) T

Re: Adding a field to a model after initial migration

2016-01-27 Thread ofeyofey
ges/django/db/models/fields/__init__.py", line 1399, in to_python parsed = parse_datetime(value) File "/usr/lib/python2.7/site-packages/django/utils/dateparse.py", line 93 , in parse_datetime match = datetime_re.match(value) TypeError: expected string or buffer Thanks, On

Adding a field to a model after initial migration

2016-01-27 Thread ofeyofey
Hi, I forgot to add a field to a model and wish to add it now. I added the line to models.py but makemigrations and migrate aren't working now. Is this possible in Django or do i need to go directly tp the sqlite DB and do it using SQL? Thanks Currently following this tutorial https://www.youtub

Re: Setting up Django

2016-01-17 Thread ofeyofey
Hi Andrew, Wow MIT cool! Thanks for looking at that. I corrected it and ForeignKey which was spelt wrong. All working now. I can move on with this tutorial. Thanks again, On Saturday, 16 January 2016 21:27:31 UTC, ofeyofey wrote: > > Hi, > > I am following the Django tutorial on the

Re: Setting up Django

2016-01-16 Thread ofeyofey
line 8, in class Choice(models.model): AttributeError: 'module' object has no attribute 'model' Thanks, On Saturday, 16 January 2016 21:27:31 UTC, ofeyofey wrote: > > Hi, > > I am following the Django tutorial on the Django site. Getting errors when > i tr

Re: Setting up Django

2016-01-16 Thread ofeyofey
tor/generator/models.py", line 4, in class Question(models.Model): File "/home/pi/DjangoPi/mathGenerator/generator/models.py", line 6, in Question pub_date = models.DateTimefield('date published') AttributeError: 'module' object has no attribute 'D

Setting up Django

2016-01-16 Thread ofeyofey
Hi, I am following the Django tutorial on the Django site. Getting errors when i try to make migrations after adding the app to the list of apps in mathGenerator/settings.py Setting up Django on a raspberry Pi. I don't think the fact that it is on api should make any difference becasue it is b