from django.db import models
from django.contrib.auth.models import User
from thumbs import ImageWithThumbsField
from apps.projects.models import Project


class News(models.Model):
    title = models.CharField(max_length=200)
    summary = models.CharField(max_length=200, null=True, blank=True)
    body = models.TextField()
    image = ImageWithThumbsField(null=True, blank=True, upload_to='images/news', sizes=((300, 300), (90, 90), ))
    author = models.ForeignKey(User)
    datetime = models.DateTimeField()
    projects_relateds = models.ManyToManyField(Project, null=True, blank=True)

    class Meta:
        verbose_name_plural = 'News'

    def __unicode__(self):
        return self.title

from datetime import datetime as dt
from django.db import models
from django.contrib.auth.models import User
from thumbs import ImageWithThumbsField
from apps.projects.models import Project


class News(models.Model):
    
    class Meta:
        ordering = ('-date_and_time',)
    
    title = models.CharField(max_length=200)
    summary = models.CharField(max_length=200, null=True, blank=True)
    body = models.TextField()
    image = ImageWithThumbsField(null=True, blank=True, upload_to='images/news', sizes=((300, 300), (90, 90), ))
    author = models.ForeignKey(User)
    date_and_time = models.DateTimeField(default=dt.now())
    projects_relateds = models.ManyToManyField(Project, null=True, blank=True)

    class Meta:
        verbose_name_plural = 'News'

    def __unicode__(self):
        return self.title

Change field name from datetime to date_and_time for avoid problems with datetime python's module
Change field name from datetime to date_and_time for avoid problems with datetime python's module

+ from datetime import datetime as dt
  from django.db import models
  from django.contrib.auth.models import User
  from thumbs import ImageWithThumbsField
  from apps.projects.models import Project
  
  
  class News(models.Model):
+     
+     class Meta:
+         ordering = ('-date_and_time',)
+     
      title = models.CharField(max_length=200)
      summary = models.CharField(max_length=200, null=True, blank=True)
      body = models.TextField()
      image = ImageWithThumbsField(null=True, blank=True, upload_to='images/news', sizes=((300, 300), (90, 90), ))
      author = models.ForeignKey(User)
-     datetime = models.DateTimeField()
+     date_and_time = models.DateTimeField(default=dt.now())
      projects_relateds = models.ManyToManyField(Project, null=True, blank=True)
  
      class Meta:
          verbose_name_plural = 'News'
  
      def __unicode__(self):
          return self.title
  
Change field name from datetime to date_and_time for avoid problems with datetime python's module
## Code Before:
from django.db import models
from django.contrib.auth.models import User
from thumbs import ImageWithThumbsField
from apps.projects.models import Project


class News(models.Model):
    title = models.CharField(max_length=200)
    summary = models.CharField(max_length=200, null=True, blank=True)
    body = models.TextField()
    image = ImageWithThumbsField(null=True, blank=True, upload_to='images/news', sizes=((300, 300), (90, 90), ))
    author = models.ForeignKey(User)
    datetime = models.DateTimeField()
    projects_relateds = models.ManyToManyField(Project, null=True, blank=True)

    class Meta:
        verbose_name_plural = 'News'

    def __unicode__(self):
        return self.title

## Instruction:
Change field name from datetime to date_and_time for avoid problems with datetime python's module
## Code After:
from datetime import datetime as dt
from django.db import models
from django.contrib.auth.models import User
from thumbs import ImageWithThumbsField
from apps.projects.models import Project


class News(models.Model):
    
    class Meta:
        ordering = ('-date_and_time',)
    
    title = models.CharField(max_length=200)
    summary = models.CharField(max_length=200, null=True, blank=True)
    body = models.TextField()
    image = ImageWithThumbsField(null=True, blank=True, upload_to='images/news', sizes=((300, 300), (90, 90), ))
    author = models.ForeignKey(User)
    date_and_time = models.DateTimeField(default=dt.now())
    projects_relateds = models.ManyToManyField(Project, null=True, blank=True)

    class Meta:
        verbose_name_plural = 'News'

    def __unicode__(self):
        return self.title
