Every model has a field by the name of  "id" which is the primary key of the
db table
u can use SlugField() for a named unique value.

On Thu, Feb 4, 2010 at 11:20 PM, harryos <oswald.ha...@gmail.com> wrote:

> hi
> (sorry about this  newbie  question..)
> I have designed an entry and a category as follows.
> The entry doesn't have a title.(The user is not expected to provide a
> title for it )It is uniquely identified by a combination of its
> published datetime and the name of the category it belongs to.
>
> class MyCategory(models.Model):
>        name=models.CharField(max_length=10)
>        description=models.TextField()
>        slug=models.SlugField(unique=True)
>
>        def __unicode__(self):
>                return self.name
>
> class MyEntry(models.Model):
>        posted_time=models.DateTimeField(default=datetime.now)
>        category=models.ForeignKey(MyCategory)
>        description=models.TextField()
>        author=models.ForeignKey(User)
>
>        def __unicode__(self):
>                return "%s%s"%(self.category.name,self.posted_time)
>
> I would like to list all entries posted at different minutes in an
> hour. and also show the details of a single entry.I am not sure how I
> can do this.
>
> I am wondering if I can get details of an entry like
> /myapp/entries/2010/jan/01/10/35/splcat
> sothat I can get an entry belonging to 'splcat' posted at 10 hrs,35
> minutes on 1st jan 2010. Is there some way I can do lookup on the
> hour,minute of posted_time?
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to