Tuesday, May 24, 2011

Re: Digest for django-users@googlegroups.com - 25 Messages in 16 Topics



On Tue, May 24, 2011 at 4:52 PM, <django-users+noreply@googlegroups.com> wrote:

Group: http://groups.google.com/group/django-users/topics

    "bh.hoseini" <bhhoseini@gmail.com> May 23 11:00PM -0700 ^
     
    hi!
    i installed python 2.7.1 on vista, then opened "command line", and
    wrote "django-admin.py startproject mysite" at first, but i faced
    syntax error:invalid syntax. could you help me solve this problem?!

     

    Karen Tracey <kmtracey@gmail.com> May 24 08:12AM -0400 ^
     
    > i installed python 2.7.1 on vista, then opened "command line", and
    > wrote "django-admin.py startproject mysite" at first, but i faced
    > syntax error:invalid syntax. could you help me solve this problem?!
     
    >It rather sounds like you've got a Python 3 install trying to interpret
    >django-admin.py, which is using Python 2.x syntax. Do you also have some
    >version of Python3 installed and is that version of Python what is
    >associated with the .py extension?
     
    >Karen
    >--
    >http://tracey.org/kmt/

     no I've 2.7 installed only,

i found out that i should have go to the directory where "django-admin.py" is downloaded with "cd ..." , and then use the above cammand.  i had written "import django",then inserted the startproject command. i think that's why i faced error!
    Vinicius Massuchetto <viniciusmassuchetto@gmail.com> May 24 07:51AM -0300 ^
     
    Have anyone been able to implement an autocomplete input field in an
    inline formset? If so, please provide some references.
     
    The main apps that do this in a normal form can't render the same
    behavior in an inline.
     
    Many thanks.
    --
    Vinicius Massuchetto
    http://vinicius.soylocoporti.org.br

     

    Karen Tracey <kmtracey@gmail.com> May 24 08:10AM -0400 ^
     
    On Tue, May 24, 2011 at 6:51 AM, Vinicius Massuchetto <
    > inline formset? If so, please provide some references.
     
    > The main apps that do this in a normal form can't render the same
    > behavior in an inline.
     
    There's a ticket open (https://code.djangoproject.com/ticket/15760) for
    adding some JS hooks for dynamic inlines in admin. However your post doesn't
    mention the word dynamic or admin so I'm not sure it's what you are looking
    for...
     
    Karen
    --
    http://tracey.org/kmt/

     

    "bh.hoseini" <bhhoseini@gmail.com> May 23 11:40PM -0700 ^
     
    hi there,
    i installed django on vista, but i don't know how to combine it with
    python, i read installation guide but it wasn't ussefull! :(

     

    Stuart MacKay <smackay@flagstonesoftware.com> May 24 12:40PM +0100 ^
     
    Without any more information on what problems you are experiencing it is
    very dificult to know where to start. I would recommend reading the
    First Steps section of the Django Documentation,
    http://docs.djangoproject.com/en/1.3/
     
    That will help in two ways, first it is a good guide for installing
    Django and second it will give everybody on this list who can help you
    with a good reference point for the steps you carried out. So when you
    say "I am having trouble with X" then it will be a lot easier to
    identify what the problem might be.
     
    Regards,
     
    Stuart MacKay
    Lisbon, Portugal

     

    AJ <brandmyself@gmail.com> May 23 11:12PM -0400 ^
     
    Virtualenv is amazing. I use one virtualenv setup for a project. never had
    any troubles. I have shared hosting with Dreamhost.com and I run my Django
    apps on a virtualenv. :)
     
     
    --
    AJ

     

    Stuart MacKay <smackay@flagstonesoftware.com> May 24 12:34PM +0100 ^
     
    John,
     
    Regarding Python 2.6 on CentOS you might find this article useful:
    http://blog.milford.io/2010/06/alt-installing-python-2-6-from-source-in-centos/
     
    I use virtualenv on a VPS running Ubuntu 10.04 LTS with Django 1.2,
    django-cms and about 10 other installed apps in various combinations.
    The apps are installed using pip from either the main python repository
    or directly from source checked out out of github and bitbucket. To date
    I have had no issues.
     
    The only problem you might come across is when updating source code from
    a repository is that any changes you make will be overwritten. So for
    example to use staticfiles with django 1.3 I had to rename directories
    in django-autocomplete so the javascript and css files would be found
    automatically. Any time I deploy a new release and update the installed
    packages using pip then I have to rename the directories again since pip
    effectively does a clean install.
     
    Regards,
     
    Stuart MacKay
    Lisbon, Portugal
     

     

    feng yu <yfbadhurt@gmail.com> May 24 01:40AM -0700 ^
     
    Hi all ,i have a question about Django forms in inheritance
    this is my models below
     
    class Database(models.Model):
    TYPE_CHOICES = (
    (u'0',u'Oracle'),
    (u'1',u'MySQL'),
    )
    name = models.CharField(max_length=200,unique=True)
    type = models.CharField(max_length=2,choices=TYPE_CHOICES)
     
    class MySQLInfo(Database):
    hostname = models.CharField(max_length=200)
     
    class OracleInfo(Database):
    maxconnect = models.CharField(max_length=200)
     
    i want to do this,
    when i open url:http://10.232.42.91:8000/search/appname/database/
    add/''
    if i select 'Oracle'' ,the fields in form will be fields in
    Oracle'Info
    and also if i select 'MySQL'', the fields in form will be fields in
    MySQLInfo
     
    in other words, i just add MySQLInfo or OracleInfo in one page, the
    fields showed in form depends on
    the value i select in field:'type'
     
    can somebody help me?

     

    Florian Hahn <flo@fhahn.com> May 23 11:58PM -0700 ^
     
    Hi,
     
    is there a way to access queryset from get_context_data without
    executing the query twice in a class based view?
     
    cheers

     

    diafygi <diafygi@gmail.com> May 23 09:32PM -0700 ^
     
    Howdy all,
     
    I have DEBUG=True in my settings.py, and I have several logging
    entries in my project (Django 1.3)
     
    However, when I am testing, there are tons of django.db.backends debug
    entries that appear, and my logs gets lost in the shuffle.
     
    Is there a way to disable django.db.backends in my settings.py? What
    is an example?
     
    Thanks,
    Daniel

     

    Sithembewena Lloyd Dube <zebra05@gmail.com> May 24 12:13PM +0200 ^
     
    Hi Everyone,
     
    I am trying to parse an XML feed and display the text of each child node
    without any success. My code in the python shell is as follows:
     
    >>>import urllib
    >>>from xml.etree import ElementTree as ET
     
    >>>content = urllib.urlopen('
    http://xml.matchbook.com/xmlfeed/feed?sport-id=&vendor=TEST&sport-name=&short-name=Po
    ')
    >>>xml_content = ET.parse(content)
     
    I then check the xml_content object as follows:
     
    >>>xml_content
    <xml.etree.ElementTree.ElementTree instance at 0x01DC14B8>
     
    And now, to iterate through its child nodes and print out the text of each
    node:
     
    >>>for node in xml_content.getiterator('contest'):
    ... name = node.attrib.get('text')
    ... print name
    ...
     
    Nothing is printed, even though the document does have 'contest' tags with
    text in them. If I try to count the contest tags and increment an integer
    (to see that the document is traversed) I get the same result - the int
    remains at 0.
     
    >>> i = 0
    >>> for node in xml_content.getiterator('contest'):
    ... i += 1
    ...
    >>> i
    0
     
    What am I getting wrong? Any hints would be appreciated.
     
    --
    Regards,
    Sithembewena Lloyd Dube

     

    Daniel Roseman <daniel@roseman.org.uk> May 24 03:42AM -0700 ^
     
    On Tuesday, May 24, 2011 11:13:31 AM UTC+1, Lloyd Dube wrote:
     
    > --
    > Regards,
    > Sithembewena Lloyd Dube
     
     
    This isn't really a Django question...
     
    Nevertheless, the issue is probably in the line "name =
    node.attrib.get('text')". What this does is get the attribute of the current
    node that has the name 'text' - ie if your XML was like this:
     
    <contest text="foo"/>
     
    However, what you probably have is this:
     
    <contest>foo</contest>
     
    in which case you just want to access the `text` property directly:
     
    name = node.text
     
    --
    DR.

     

    Ori Livneh <ori.livneh@gmail.com> May 24 03:00AM -0400 ^
     
    Check out the python-dateutil <http://labix.org/python-dateutil> module (not
    in the standard lib, but available via pip and easy_install). It makes
    calculating time deltas easy.
     
    Anyways, try something like this:
     
    #!/usr/bin/env python
    from datetime import datetime
    from dateutil.relativedelta import relativedelta
     
    employees = {}
    now = datetime.now()
    ranges = [(0, 3), (3, 6), (6, 12), (12, 24)]
     
    for (a, b) in ranges:
    start_date = now - relativedelta(months=b)
    end_date = now - relativedelta(months=a)
    employees[(a, b)] = Employees.objects.filter(
    doj_date__range=(start_date, end_date))
     

     

    sushanth Reddy <sushanth53@gmail.com> May 24 03:56PM +0530 ^
     
    Thank you for the response,Let me give a try and let you know.
     
     
    Thanks & Regards
    sushanth reddy
     
     

     

    Amit Sethi <amit.pureenergy@gmail.com> May 24 02:46PM +0530 ^
     
    Hi all , I am not able to understand this but it seems while extending
    the base template removes form tag. Is this possible in some scenario.
    This is the only explanation I am able to come up with for the
    behavior I am seeing in my app.
     
    --
    A-M-I-T S|S

     

 Topic: GET/POST
    Amit Sethi <amit.pureenergy@gmail.com> May 24 02:49PM +0530 ^
     
    I think this is csrfmiddleware issue . Just add {% csrf_token %} like this
    <form something method='post'> {% csrf_token %}
     
     
    --
    A-M-I-T S|S

     

    Alagu Madhu <almadhu@gmail.com> May 24 01:22AM -0700 ^
     
    Hi,
     
     
    sample/
    media/
    js/jquery.1.6.1.min.js
    css/
    static/
    js/jquery.1.6.1.min.js
    css/
     
     
     
    settings.py
     
    import os
    PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
    MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media/')
    MEDIA_URL = '/media/'
    STATIC_ROOT = os.path.join(PROJECT_DIR, 'static/')
    STATIC_URL = '/static/'
     
     
    urls.py
     
     
    urlpatterns = patterns('',
    (r'^media/(?P<path>.*)$', 'django.views.static.serve',
    {'document_root': settings.MEDIA_ROOT}),
    (r'^static/(?P<path>.*)$', 'django.views.static.serve',
    {'document_root': settings.STATIC_ROOT}),
     
     
     
     
     
     
    http://192.168.1.141:44/static/js/jquery.1.6.1.min.js
     
     
     
    Page not found (404)
    'js\jquery.1.6.1.min.js' could not be found
     
     
     
    Thanks
     
    Madhu

     

    Uwe Schuerkamp <uwe.schuerkamp@gmail.com> May 24 01:19AM -0700 ^
     

    > In order to succeed you must find out how django stores passwords and how your current passwords are stored.
    > That way you can start converting , probably by writing some python conversion script.
    > You can find out more on how django stores it's passwords herehttp://docs.djangoproject.com/en/dev/topics/auth/#passwords
     
    I think I may have found a solution by simply comparing the password
    the user enters to the result of the old_password() function in mysql,
    and if that matches I can store the password in the auth_user table
    using the set_password() call which will convert the hash to "modern"
    django standards.
     
    Once I call save() on the new user object, the user should be found in
    django's auth_user table from then on, correct? I've already managed
    to connect to the old database using django's multiple dababase
    feature and some raw() sql queries on the old user table.
     
     
     
    All the best, Uwe

     

    Carsten Fuchs <carsten.fuchs@cafu.de> May 23 03:17PM +0200 ^
     
    Hi all,
     
    On 18.05.2011 18:10, Carsten Fuchs wrote:
    > The intention with this table is to exactly mimic the default intermediate table that Django would
    > create when the keyword "through" is not used in the ManyToManyField statement (manually adding the
    > UNIQUE(...) database constraint), with just the "to_field" not at 'id' but at 'key'.
     
    Anyone?
     
    Many thanks and best regards,
    Carsten
     
     
     
     
    --
    Cafu - the open-source Game and Graphics Engine
    for multiplayer, cross-platform, real-time 3D Action
    Learn more at http://www.cafu.de

     

--
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.
To unsubscribe from this group, send email to django-users+unsubscribe@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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment