Can I ask for some assistance please.

For my project I will need to upate the database from an external xml file 
consistently. The xml is like this one 
http://old.racingnsw.com.au/Site/_content/racebooks/20140515GOSF0.xml
If i have create my model objects, most of which will have a direct 
correlation to the xml file, but there will be extra model objects and 
fields relating to user input. How can I do updates to my database via xml.

There are 2 docs I have been reviewing 
https://docs.djangoproject.com/en/1.6/howto/initial-data/#providing-initial-data-with-fixtures
 
and https://docs.djangoproject.com/en/1.6/topics/serialization/. 

The guides talk about creating a fixture but I am not sure it is 
appropriate exactly and I am unsure from the guide how I would setup a 
mapping so that the xml data went to the correct model object.
How do I do this?

Currently I have my model as.

from django.db import models

class Meeting(models.Model):
    location = models.ForeignKey(Venue)
    MeetingRace = models.ForeignKey(Race)
    meeting_id = models.IntegerField(8)
    meeting_date = models.DateField()
    rail = models.CharField(max_length=75)
    weather = models.CharField(max_length=10)
    trackcondition = models.CharField(max_length=15)
    
class Venue(models.Model):
    NameVenue = models.CharField(max_length=50)
    FullNamevenue = models.CharField(max_length=70)
    ClubCode = models.IntegerFields(5)
    AssosciationClass = models.IntegerField(5)
    
class Race(models.Model):
    RaceHorse = models.ForeignKey(Horse)
    RaceID = models.IntegerField(8)
    RaceNumber = models.IntegerField(3)
    RaceDivision = models.IntegerField(10)
    RaceName = models.CharField(max_length=80)
    RaceClass = models.CharField(max_length=20)
    RaceDistance = models.IntegerField(12)
    RaceMinWeight = models.IntegerField(3)
    RaceRaisedWeight = models.IntegerField(3)
    RaceAge = models.IntegerField(3)
    RaceGrade = models.IntegerField(3)
    RaceWeightCondition = models.CharField(max_length=80)
    # Check timing method, fastest, sectional
    #Review adding conditionals

class Horse(models.Model):
    HorseTrainer = models.ForeignKey(Trainer)
    HorseJockey = models.ForeignKey(Jockey)
    HorseName = models.CharField(max_length=40)
    HorseID = models.IntegerField(10)
    HorseBlinkers = models.IntegerField(3)
    HorseBarrier = models.IntegerField(3)
    HorseWeight = models.IntegerField(3)
    HorseRating = models.IntegerField(3)

Thanks

Sayth
    HorseDescription = models.CharField(max_length=60)

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/f8e008bf-1f0a-4a0a-a35c-04c59f9997f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to