Although at the intermediate level with regard to Python,
I'm just beginning with Django, running Ubuntu 14.4LTS
in a venv established by
$ virtualenv -p python3 venv

I set up a journal app with a models.py file and then
changed some of the fields.  Now I can't seem to get rid of
the following warning:
WARNINGS:
journal.Journal.date: (fields.W161) Fixed default value provided.
HINT: It seems you set a fixed date / time / datetime value as default for this field. This may not be what you want. If you want to have the current date as default, use `django.utils.timezone.now`

I deleted the db.sqlite3 file thinking that would allow me to start fresh but somehow django remembers what was there before although it's not there now:
file journal/models.py:
from django.db import models
from django.utils import timezone

class Journal(models.Model):
    """
    Each instance represents a journal entry to be stored in the
    Journal table.  The automatically created auto-incrementing
    primary key serves as the entry number.
    """
    date = models.DateTimeField(default=timezone.now())
    user = models.CharField(max_length=24)
    description = models.CharField(max_length=256)
    def __str__(self):
        ret = ["  #{:0>3} on {:<12} by {}."
                .format(self.id,
                        self.date.strftime('%Y-%m-%d %H:%M'),
                        self.user)]
        for line in self.description.split('\n'):
            ret.append("    {}".format(line))
        return '\n'.join(ret)

Any advice would be appreciated.
Alex

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/25bfa6241296e00dca1e76be74a85e04%40sonic.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to