Thanks for the link. I'm spent a good part of the day trying to figure it
out to no avail. My next approach was to describe how I walked through it
and see where I went wrong.
I went into my models.py
from django.db import models
from django.core.urlresolvers import reverse
from datetime import *
from django.forms import ModelForm
# Create your models here.
class Ride(models.Model):
title = models.CharField(max_length=255)
speed = models.CharField(max_length=255)
discipline = models.CharField(max_length=255)
slug = models.SlugField(unique=True, max_length=255)
description = models.CharField(max_length=255)
scheduletime = models.DateTimeField('date published')
lat = models.FloatField(blank=True, null=True)
lon = models.FloatField(blank=True, null=True)
published = models.BooleanField(default=True)
created = models.DateTimeField(auto_now_add=True)
class Meta:
ordering = ['-created']
def __unicode__(self):
return u'%s' % self.title
def get_absolute_url(self):
return reverse('blog.views.post', args=[self.slug])
class RideForm(ModelForm):
class Meta:
model = Ride
fields = ('title', 'speed', 'discipline', 'description',
'scheduletime', 'lat', 'lon')
I became really confused after this point. It is unclear to me how I cause
a html site to produce a request and for it to make its way to this model.
*Approach #2*
I tried to solve this another way. I looked at the polls-tutorial which I
have done before. I tried to replicate their vote function in views.py. The
challenge that I found was that I struggled to make a unique object on the
response of the program. Does anyone have any tips for making this happen.
Thanks
On Monday, October 21, 2013 2:55:33 AM UTC-7, Daniel Roseman wrote:On Monday, 21 October 2013 01:24:22 UTC+1, Ideo Rex wrote:
Hello,
I'm relatively new to Django. So I have a working (local) web
application. I can create new model objects from the admin site, but I
would like my users to be able to create their own objects and save them to
the database. I'm really confused on the over arching process on how this
is down and I would appreciate it if someone could lead me in the correct
direction.
I want to allow my users:
1. fill in information on a page
2. submit this page to the database
3. redirect them to a page that reflects their input ("You successfully
submitted this {{title}}")
Thanks
This is indeed a very simple request. And it is fully covered in the
documentation about forms: see
https://docs.djangoproject.com/en/1.5/topics/forms/ for an introduction,
and
https://docs.djangoproject.com/en/1.5/topics/forms/modelforms/ for
the specifics about saving form data to a model instance.
(The other answer to this question, from Sergiy, seems to have completely
missed the point with his link to the auth docs, unfortunately.)
--
DR.
--
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+unsubscribe@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/3110176c-ce5f-4b6e-bb78-b456423a78b6%40googlegroups.com.For more options, visit
https://groups.google.com/groups/opt_out.