
from django.db import models


VALUE_MAX_LEN = 128


class GenericEvent(models.Model):
    """Represents a measurement event abstracting away what exactly is
    measured.
    """

    sensor = models.ForeignKey('core.GenericSensor')
    datetime = models.DateTimeField()
    value = models.CharField(max_length=VALUE_MAX_LEN)


class Event(models.Model):
    """Base class for sensor-specific event types"""

    generic_event = models.OneToOneField('core.GenericEvent')

    def value_to_string(self):
        """Event.value_to_string() -> unicode

        Returns a string representation of the
        """

        raise NotImplementedError(self.__class__.value_to_string)

    class Meta:
        abstract = True

from django.db import models


VALUE_MAX_LEN = 128


class GenericEvent(models.Model):
    """Represents a measurement event abstracting away what exactly is
    measured.
    """

    sensor = models.ForeignKey('core.GenericSensor')
    datetime = models.DateTimeField()
    value = models.CharField(max_length=VALUE_MAX_LEN)


class Event(models.Model):
    """Base class for sensor-specific event types"""

    generic_event = models.OneToOneField('core.GenericEvent')
    datetime = models.DateTimeField()

    def value_to_string(self):
        """Event.value_to_string() -> unicode

        Returns a string representation of the
        """

        raise NotImplementedError(self.__class__.value_to_string)

    class Meta:
        abstract = True
Add datetime field to Event model in sensor.core
Add datetime field to Event model in sensor.core

  
  from django.db import models
  
  
  VALUE_MAX_LEN = 128
  
  
  class GenericEvent(models.Model):
      """Represents a measurement event abstracting away what exactly is
      measured.
      """
  
      sensor = models.ForeignKey('core.GenericSensor')
      datetime = models.DateTimeField()
      value = models.CharField(max_length=VALUE_MAX_LEN)
  
  
  class Event(models.Model):
      """Base class for sensor-specific event types"""
  
      generic_event = models.OneToOneField('core.GenericEvent')
+     datetime = models.DateTimeField()
  
      def value_to_string(self):
          """Event.value_to_string() -> unicode
  
          Returns a string representation of the
          """
  
          raise NotImplementedError(self.__class__.value_to_string)
  
      class Meta:
          abstract = True
Add datetime field to Event model in sensor.core
## Code Before:

from django.db import models


VALUE_MAX_LEN = 128


class GenericEvent(models.Model):
    """Represents a measurement event abstracting away what exactly is
    measured.
    """

    sensor = models.ForeignKey('core.GenericSensor')
    datetime = models.DateTimeField()
    value = models.CharField(max_length=VALUE_MAX_LEN)


class Event(models.Model):
    """Base class for sensor-specific event types"""

    generic_event = models.OneToOneField('core.GenericEvent')

    def value_to_string(self):
        """Event.value_to_string() -> unicode

        Returns a string representation of the
        """

        raise NotImplementedError(self.__class__.value_to_string)

    class Meta:
        abstract = True
## Instruction:
Add datetime field to Event model in sensor.core
## Code After:

from django.db import models


VALUE_MAX_LEN = 128


class GenericEvent(models.Model):
    """Represents a measurement event abstracting away what exactly is
    measured.
    """

    sensor = models.ForeignKey('core.GenericSensor')
    datetime = models.DateTimeField()
    value = models.CharField(max_length=VALUE_MAX_LEN)


class Event(models.Model):
    """Base class for sensor-specific event types"""

    generic_event = models.OneToOneField('core.GenericEvent')
    datetime = models.DateTimeField()

    def value_to_string(self):
        """Event.value_to_string() -> unicode

        Returns a string representation of the
        """

        raise NotImplementedError(self.__class__.value_to_string)

    class Meta:
        abstract = True