Polls tutorial receive object not object representation
Hi Just seeking a little clarification. In the Polls tutorial we get this section. >>> p = Poll.objects.get(pk=1) # Display any choices from the related object set -- none so far.>>> p.choice_set.all()[] # Create three choices.>>> p.choice_set.create(choice_text='Not much', votes=0)>>> p.choice_set.create(choice_text='The sky', votes=0)>>> c = p.choice_set.create(choice_text='Just hacking again', votes=0) # Choice objects have API access to their related Poll objects.>>> c.poll # And vice versa: Poll objects get access to Choice objects.>>> p.choice_set.all()[, , ] Now the only thing is that when I call p.choice_set.all() I don't get the representation 'The sky' or 'Just Hacking again' . I receive choice object itself. Is this normal? In [14]: c = p.choice_set.create(choice_text='Just Hacking again', votes=0) In [15]: c.poll Out[15]: In [16]: p.choice_set.all() Out[16]: [, , , ] Thanks Sayth -- 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+unsubscr...@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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: PHP vs Django
Why leave JS? Use node.js or meteor . PHP has many frameworks any in particular you were referring to Cake, symfony2, send? Sayth On Monday, January 28, 2013, Vijaya Reddy wrote: > Hello All, > > I want to build my career in web development. I have learned CSS,HTML,JS. > Now i am planning to learn either PHP or Dajngo. I have good knowledge in > python. > Which one is good(Django or PHP)? > > > Thanks and Regards > Vijaya Reddy > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to > django-users@googlegroups.com 'django-users@googlegroups.com');> > . > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com 'django-users%2bunsubscr...@googlegroups.com');>. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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+unsubscr...@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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Missing peice before best practises
Hi I am looking for a resource that gives me that Knowledge I need to grasp and understand Django. For python I have learnt LPTHW and completed codeacademy and read the Magnus lie Hetland book. I have completed the Django polls tutorial, and I bought two scoops of Django. Now I have read the first 4 chapters of two scoops but its more a design rules book not a how to book, so it will be good when I have more experience and think I could do this better. This basically holds true for the effective django as well. So I turned to the django book online, but have a lack of faith here as the installation chapter mentions nothing of isolated environments and using pip and virtual env to install. Where do I go to get that intermediate step of how to Django? Thanks Sayth -- 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+unsubscr...@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. For more options, visit https://groups.google.com/groups/opt_out.
Missing peice before best practises
Any thoughts? -- 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+unsubscr...@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. For more options, visit https://groups.google.com/groups/opt_out.
Re: Missing peice before best practises
> Its a curious complaint you have. You don't want >to use the >documentation since it doesn't document >something that you already There's a misunderstanding here it's a) Not django docs but the opensource django book. B) the book ends up describing over a vast area all the possible different install options over Win/Mac/Linux. I appreciate its an open effort but as a newbie if you know something is better and according to other sources there is better practises would you trust the rest of the info or perhaps value it less ? @Tom GSWD does look like a good resource, and the docs do look ok. Just wanted to be able to work through a practical example when learning, we all learn best by copying initially and then tweaking with our options as experience increases. This is oddly the only value difference between rails and django is that there is far more online courses and tutorials to say "come join rails". It's just that I like python and the python Eco better. Sayth On Wednesday, June 26, 2013, Tom Evans wrote: > On Wed, Jun 26, 2013 at 2:19 PM, Sayth Renshaw > > > wrote: > > Any thoughts? > > First of all, there is no requirement to use either of those tools to > use django. > > Its a curious complaint you have. You don't want to use the > documentation since it doesn't document something that you already > know about! > > In reality, why should Django devote lots of space in it's manual to > the use of pip, the python installer, and virtualenv, the python > environment management tool. > > You'll note that these aren't Django tools, they are stock utilities > that you would use with any python application. Django is not a > special python application, it is very much a standard python library > that you integrate in to your application. Because it is standard, the > documentation that pip and virtualenv supply themselves is more than > sufficient. > > Having said all that, Django does devote some column space to virtualenv: > > > https://docs.djangoproject.com/en/1.5/intro/reusable-apps/#installing-python-packages-with-virtualenv > > Cheers > > Tom > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/f1RvG1vpVpg/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@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. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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+unsubscr...@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. For more options, visit https://groups.google.com/groups/opt_out.
Re: Missing peice before best practises
On Monday, July 1, 2013, Tom Evans wrote: > On Wed, Jun 26, 2013 at 10:03 PM, Sayth Renshaw > > > wrote: > > This is oddly the only value difference between rails and django is that > > there is far more online courses and tutorials to say "come join rails". > > Yep, they say "come join rails", and not "come join Ruby". This > encourages people to look for "rails best practices" and not "ruby > best practices". Conversely with python/django. > > Cheers > > Tom > > Is that good though? Barring 2 scoops there is no new material to recognise and guide users to the new features of Django and to get beginner Django developers on board quicker. It leads to bits of info for each python framework but nothing comprehensive. Sayth -- 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+unsubscr...@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. For more options, visit https://groups.google.com/groups/opt_out.
Re: Missing peice before best practises
On Monday, July 1, 2013, Tom Evans wrote: > On Mon, Jul 1, 2013 at 11:37 AM, Sayth Renshaw > > > wrote: > > Is that good though? > > > > Barring 2 scoops there is no new material to recognise and guide users to > > the new features of Django and to get beginner Django developers on board > > quicker. > > > > It leads to bits of info for each python framework but nothing > > comprehensive. > > > > Sayth > > > > Virtualenv, pip etc are not features of Django, they are features of > python. It is right that Django mentions them in places, it is doubly > right that it does not attempt to duplicate the fine documentation > that pip and virtualenv possess themselves. > > Cheers > > Tom > > Agreed good tutorials would show steps and then point to resources for further reading, At this point though it appears there is a scarcity of good tutorials for current Django. Sayth -- 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+unsubscr...@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. For more options, visit https://groups.google.com/groups/opt_out.
Re: Missing peice before best practises
Apologies Amirouche for the late reply. The documentation is good, but I like many apparently(based on tutorials for other envs) prefer a hands on approach to a documentary approach. This is the place where Django doesn't have much depth in its ecosystem. It has no current books and no hands on tutorial other than GSWD which creates a lot of lifting with installing ruby, vms, vagrant and so on just to start with Django. Flask is starting to get a few tutorials popping up in real python for web, http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world, and in the works the Picard flask kickstarter http://www.kickstarter.com/projects/1223051718/practical-flask-book-project. I put my money where my mouth is and sponsor these kickstarters as there is such a shortage of good info. As I would back you Amirouche if you started a Kickstarter to give Django a good practical and hands on tutorial. Cheers Sayth On Thu, Jul 4, 2013 at 1:05 AM, Amirouche Boubekki < amirouche.boube...@gmail.com> wrote: > > > > 2013/7/1 Sayth Renshaw > >> >> >> On Monday, July 1, 2013, Tom Evans wrote: >> >>> On Mon, Jul 1, 2013 at 11:37 AM, Sayth Renshaw >>> wrote: >>> > Is that good though? >>> > >>> > Barring 2 scoops there is no new material to recognise and guide users >>> to >>> > the new features of Django and to get beginner Django developers on >>> board >>> > quicker. >>> > >>> > It leads to bits of info for each python framework but nothing >>> > comprehensive. >>> > >>> > Sayth >>> > >>> >>> Virtualenv, pip etc are not features of Django, they are features of >>> python. It is right that Django mentions them in places, it is doubly >>> right that it does not attempt to duplicate the fine documentation >>> that pip and virtualenv possess themselves. >>> >>> Cheers >>> >>> Tom >>> >>> >> Agreed good tutorials would show steps and then point to resources for >> further reading, >> >> At this point though it appears there is a scarcity of good tutorials for >> current Django. >> > > pip+virtualenv[wrapper] is a pratice not something that will allow you to > build a skyrocket as-is, you can live without it. > > The documentation is good, and overall ecosystem alive and active, what do > you need more ? They are several CMS and admin apps, blog solutions etc... > They are still improvements and stabilisation to be done on many (utility) > apps... Everything I want to say is that outside the django tutorial, and > anybooks you read, the best way to improve your skills it to [re]build > something... > > Time to time, I think about writring a set of tutorial about a CMS or > Social Network from scratch, but experience says that except the actual > code, the remaining issues are solved and well documented outside this > virtual project, so this would, I think, have little value. > > > > > HTH, > > Amirouche > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/f1RvG1vpVpg/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@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. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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+unsubscr...@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. For more options, visit https://groups.google.com/groups/opt_out.
Workflow/tools assistance
I have been learning the basics of django, SQL, XML and MySQL / Maria.db. Trying to design a project and I can't get a concept of how to achieve it. Looking for some guidance in tools or process to achieve it. There is one specific part that trips me up. Whilst I can parse a basic SQL file, read csv files, put a file to a database these are all based off simple examples. What I need to do is take an XML file, parse it and split it into 3 related tables and update the entries into my database. It is these entries that the app will view, have details added and updated and calculated. The tools in examples are lxml, sqlalchemy, matplotlib for graphing. How in django do I make this happen ? What should I read more on? I am sure people do this all the time. Sayth -- 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+unsubscr...@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. For more options, visit https://groups.google.com/groups/opt_out.
Re: Workflow/tools assistance
On Thursday, September 12, 2013, Germán Larraín wrote: > Some comments: > > * why use sqlalchemy if Django has its own ORM? > * you mentioned parsing SQL entries; watch out! > * if you are starting a new project, I seriously recommend you to use > PostreSQL, not MySQL/Maria DB > > - > Hi why use sqlalchemy if Django has its own ORM? I was just googling for methods and examples of how people do this. Of the very scarce info out there Sqlalchemy was in it. In the django docs it has initial fixtures. https://docs.djangoproject.com/en/1.2/howto/initial-data/#providing-initial-data-with-fixtures But this doesn't seem to provide the functionality of loading recurring data via XML data thru ORM to database. Sayth -- 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+unsubscr...@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. For more options, visit https://groups.google.com/groups/opt_out.
Re: Workflow/tools assistance
On Friday, September 13, 2013, Thomas Lockhart wrote: > On 9/12/13 6:44 AM, Sayth Renshaw wrote: > > > > On Thursday, September 12, 2013, Germán Larraín wrote: > >> Some comments: >> >> * why use sqlalchemy if Django has its own ORM? >> * you mentioned parsing SQL entries; watch out! >> * if you are starting a new project, I seriously recommend you to use >> PostreSQL, not MySQL/Maria DB >> > +1 > > I was just googling for methods and examples of how people do this. Of the > very scarce info out there Sqlalchemy was in it. > > That would be a red herring. > > > In the django docs it has initial fixtures. > > > https://docs.djangoproject.com/en/1.2/howto/initial-data/#providing-initial-data-with-fixtures > > But this doesn't seem to provide the functionality of loading recurring > data via XML data thru ORM to database. > > I would write a python script to stuff it in to the database directly or > if you want others to be able to upload files to be read in then integrate > an upload capability with some backend python code. If the files are large > then you will want to have a separate thread do the work. And if the files > need validation you may want to break this into two pieces so the file is > uploaded and the file name is stashed in a model, then another thread or > cron job can pick it up and do some processing, maybe keeping track of the > status in the database also. > > For a separate python script you may need to write some simple SQL, but > for the django portions you would not need to touch that. > > Write your models for the dataflow you need, then fill in the other pieces > with some code. > > hth > > - Tom > > > Users won't need to upload scripts, I would be updating with about 4 XML files per week. Users could add info or update info to specified fields only. I then want the users to be able to interact with interactive graphs based on the data. Thanks for the feedback Sayth -- 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+unsubscr...@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. For more options, visit https://groups.google.com/groups/opt_out.
Devils advocate question
With django what benefit do I get for the extra build time over Drupal or Rails. Configuration I assume but real world benefits not my/our joy of configuration. Why hasn't a cms been designed off django or python? A language cultural effect yoy would think python would be more stable than php/drupal. Sayth -- 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+unsubscr...@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/a4c22366-0f9d-417c-8d09-5a0501f2f964%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Devils advocate question
Wow never knew mezzanine existed, that's interesting. Yes php hosting is cheap, but so is digitalocean and it fully supports python and django. Sayth -- 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+unsubscr...@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/e2a68abd-1e64-4e28-bedb-3fe8cb2bae62%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Devils advocate question
Definitely Thanks Cal. Hadn't realized that with digitalocean. Been spending my time in ipython and R and plotly and wanted to get some stuff out there. Rails not really in the equation too much black magic. Saw pythonanywhere, Heroku, Bitnami they just don't have a fixed cost. Eg Bitnami says about $6.95 a month but it's about. I do something random abs could cost myself a bucket. Sayth On Wed, 17 Dec 2014 11:14 AM Cal Leeming wrote: > One thing to note, DigitalOcean is truly awesome but it is a no-frills > service. You get an API and raw performance at dirt cheap pricing, > everything else you have to handle yourself. > > If you don't have the necessary devops/sysadmin skills, e.g. knowledge of > how to recover crashed databases, corrupt filesystems etc, then you might > want to consider something like Heroku where you can leverage the power of > build packs. This can get *very* expensive, very quickly, but for small > databases and minimal throughput, you'll be fine. > > To be clear, I don't want to put you off using DigitalOcean because I > honestly think they are the best thing to happen to the unmanaged hosting > industry in a long time. At the same time, you should be aware that this > cheap, raw performance comes with a trade off. If you want to push and > forget, use Heroku. But if you want excellent performance, low pricing and > complete control, look at DigitalOcean + Packer + CircleCI. (you can push > to git, which then triggers a CircleCI build, which then triggers a packer > build, which then spins up a new VM at DO on that snapshot. However you > then need to handle destroying old instances, and automating the switch > over between instances, which would need to be some sort of LB or DNS > change over using something like CloudFlare). It gets pretty intense :) > > tl-dr; Deployment of Rails vs Django has the same considerations and > complexities. You'd have to consider the above no matter which you use > anyway. > > As for which would be more preferable, that comes down to personal taste. > My advice would be to review them all, pick two or three, and see which one > excites you the most. > > Hope this helps dude! > > Cal > > On Wed, Dec 17, 2014 at 12:03 AM, Sayth Renshaw > wrote: > >> Wow never knew mezzanine existed, that's interesting. Yes php hosting is >> cheap, but so is digitalocean and it fully supports python and django. >> >> Sayth >> > >> -- > > >> 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+unsubscr...@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/e2a68abd-1e64-4e28-bedb-3fe8cb2bae62%40googlegroups.com >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/NmnbelIldz8/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@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/CAHKQagGsZLaGjJEaSC1StTVPeMdCxW7h%3D5XzNk-pLYRRf2ccFw%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAHKQagGsZLaGjJEaSC1StTVPeMdCxW7h%3D5XzNk-pLYRRf2ccFw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@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/CAN2of00-OZLLg7b7NOnexUWoHyw12EvBJEYbXdZmq-ZmmjpHUw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Model Objects and Updating db via XML
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 django-users+unsubscr...@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/f8e008bf-1f0a-4a0a-a35c-04c59f9997f6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Model Objects and Updating db via XML
Do I need to provide more information or clarity, or is this a harder question than I imagined and I just need to wait for a guru to come through? Sayth -- 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+unsubscr...@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/bb90f0a2-022b-4868-969e-1aeb93753f0c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Model Objects and Updating db via XML
Thanks for the response I can look at converting the fixtures to json of that would make it work. I wouldn't contribute xml.support at this stage, the quality of my contribution would likely be poor. Sayth On 14/05/2014 4:24 pm, "Avraham Serour" wrote: > Fixtures are usually in json. Not sure if the is support for importing > fixtures in XML > In any case you can always parse them yourself and create the proper > objects > > Don't forget that this is an open source project, you can code XML support > and contribute > On May 13, 2014 10:40 PM, "Sayth Renshaw" wrote: > >> 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-fixturesand >> 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 django-users+unsubscr...@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/f8e008bf-1f0a-4a0a-a35c-04c59f9997f6%40googlegroups.com<https://groups.google.com/d/msgid/django-users/f8e008bf-1f0a-4a0a-a35c-04c59f9997f6%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/TZ2GbmlVk1o/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@googlegroups.com. > To post to this gr
Re: Model Objects and Updating db via XML
Thanks Tom, I have set up a way to extract the elements I want with xmltodict and played with lxml.objectify last night and that would work as well. But what exactly in django models am I using to bring in the data? Sayth On 15/05/2014 1:13 am, "Tom Evans" wrote: > On Tue, May 13, 2014 at 8:40 PM, Sayth Renshaw > wrote: > > 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? > > > > I don't think you want fixtures, even though there are XML fixtures. > This is basically a data feed which periodically you wish to import in > to your own database. Fixtures are normally exports of your own > database. I think it would be very difficult to ensure that your > database always matches the contents of an XML file produced by a 3rd > party. > > You could use xslt to transform the 3rd party xml in to the right > format for an xml serialisation, but that would involve using xslt. > > What I would do is write a management command that parses the XML (I > like lxml), and then iterates through it, using xpath to pull out > relevant parts of the doc, and then use standard django models to > create this data in the database, taking care not to insert duplicate > data when it exists in both DB and XML. > > Cheers > > Tom > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/TZ2GbmlVk1o/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@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/CAFHbX1KCPYxxL%3Duj2CQkX1EiC5Y%3D-DsBSfOqm5YykbxXWT%2B_dA%40mail.gmail.com > . > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@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/CAN2of00-Lcv6VAeL0Lv%3Dbi7HniBB_YuzitWwy%3DsWiA0g3u0TnQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Django Docs not returning search results - 1.10
Hi Trying to check if this is an odd problem I am expereincing or there is an issue. I have tried searching the django docs for Kivy in regards to the https://pypi.python.org/pypi/kivy-django/1.9.1 package which refers to the docs for further information. Search terms used: kivy kivy-django Both return a header advising 370 results "370 results for *kivy-django* in version 1.10". There is however no actual search results displaying below. Tried on Firefox and chrome on multiple computers and chrome on android phone all the same. Any ideas whats occurring? Sayth -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cb578d5d-3796-48fa-b1d5-a1f959dd78b3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Django Docs not returning search results - 1.10
On Friday, 18 November 2016 00:31:42 UTC+11, Tim Graham wrote: > > It's a known issue: https://github.com/django/djangoproject.com/issues/713 > > The Django docs don't contain information about third-party packages, > however, so searching there to find information about kivy isn't the > correct place. > > > Thanks for showing the error. Using the django docs as its the pypi website that advises to use them, probably in error. Sayth -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f2b8462b-7839-4ed3-98d4-99a02c6d52d8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Django Grids - Display grids/tables
Hi Wanting some advice on which packages you use with django to display your data to your users in grids, so think sports data 17 rows 10 columns x2 for both teams. Looking in the packages here https://www.djangopackages.com/grids/ . What advice can you give me if you have done something similar? I am going to be using mongo as the data store if this would influence your advice as well. thanks Sayth -- 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+unsubscr...@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/12632d80-1123-4b5c-8c2e-46011f0e91fd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.