Re: DKIM Email
This snippet looks just about right, and the timing of Atwood's post was perfect for me, as I am building such a system right now. I'll post over on the snippet if I discover any problems getting the code to work. Thanks for putting this together. On Apr 21, 8:16 pm, Simon Meers wrote: > For anyone else who learned about DKIM recently [1], I've uploaded a > snippet for a DKIM-signing email backend [2]. > > [1]http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-em... > [2]http://www.djangosnippets.org/snippets/1995/ > > -- > 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 > athttp://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.
form class
Hi, I wanted to ask if I am somehow "obliged" to use the form class provided by Django framework. I can see its use on "static" forms (eg. registration forms or account forms) but most of the forms I write are "dynamic" (forms that are dynamically created depending on the user, whith input fields like ) I am new to Django, so I carry some old habits with me. Does the django's form class provide solutions for more complicated forms? Should I study it, further? Thanks, Chris -- 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.
Re: I have a problem with the pagination with haystack and apache solr
You should have defined the fields yourself in you search_indexes.py file in your app http://docs.haystacksearch.org/dev/searchindex_api.html#quick-start Solr knows about these because you copy your generated schema.xml file into the conf folder Ray On Apr 22, 6:46 pm, Ariel wrote: > I don't know how to know that because I don't know the name of the fields in > the index. > How could I know it ??? > Regards > Ariel > > > > > > On Wed, Apr 21, 2010 at 4:40 AM, Ray McBride wrote: > > How many results are returned when you search using the solr admin > > interface? > > > Are you using the code that I posted for you previously? > > > Ray > > > On Apr 19, 6:29 pm, Ariel wrote: > > > Hi everybody: > > > I have a big problem with pagination using apache solr and haystack, this > > is > > > what it is happening: I have a site where the news are being indexing > > with > > > haystack and solr, but the problem is that when a I make the search the > > > pagination is showing me more match results that what really exists even > > > more results that total news in my database, for example I have only 20 > > news > > > in the database but when I make a search the pagination said 40 matching > > > results are found then when I navigate with the "next" link to see the > > other > > > results any result is showed. > > > > I hope I have made a good explanation of my problem. > > > Could you help me please ??? > > > I don't know why it is happening that > > > Regards. > > > Ariel > > > > -- > > > 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 > groups.com> > > . > > > For more options, visit this group athttp:// > > 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 > groups.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 > athttp://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.
Re: Any way to do select_related() moving backward?
On Apr 23, 12:03 am, Continuation wrote: > Is there any way to do something similar to select_related() when > following a foreign key relationship backward? > > For example, > b = Blog.objects.get(id=1) > e = b.entry_set.all() > > Any way to retrieve both b and e in one single DB query? No, not in a single query. But there are some techniques you can use to minimise the queries if you are getting a bunch of Blog entries at once and want to get all their entries. I go through some of these on my blog (excuse the plug): http://blog.roseman.org.uk/2010/01/11/django-patterns-part-2-efficient-reverse-lookups/ -- DR. -- 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.
Re: add permission to new model instances
FYI, I have been looking to django authority as well http://packages.python.org/django-authority/index.html Which apparently supports per-object-permissions (row-level). I just can't get it to work yet... Regards, On Apr 22, 6:04 pm, Shawn Milochik wrote: > What you're describing is more of a row-level permissions system. The > permissions system that ships with contrib.auth is table-level, not > row-level. There has been some talk on this list about ways to go about it, > but I don't think there's an out-of-the-box solution for it yet. > > Off of the top of my head (and I'm hoping others will chime in with > improvements), you can use a custom manager[1] for the Layer model which > requires the request.user to be passed in. That way, you will be able to > control access in the manager itself and hide that logic from your views. > This is assuming that you have a foreign key to the user who created each > Layer and, given request.user, will be able to determine what permissions > they should have. > > Shawn > > [1]http://docs.djangoproject.com/en/1.1/topics/db/managers/#id2 > > -- > 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 > athttp://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.
Sending email via SMTP in a unit test
Is there a way to run unit tests in such a way that email will be sent via the SMTP email backend when there's a call to send_mail in the unit test? -- 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.
Re: Why doesn't my isinstance() work?
On 22/04/10 04:34, Lachlan Musicman wrote: I presume this will make you all wince, but while appreciating the discussion I've caused I've solved it thusly: views.py def index(request): all_authors = Author.objects.all() all_origAuthors = [] all_translators = Translators.objects.all() for author in all_authors: if author in all_translators: pass else: all_origAuthors.append(author) return render_to_response('books/index.html',locals()) Haven't really been following this thread, but taken in isolation: Translator is a multi-table-inheritance subclass of Author, and that means its primary key is a foreign key back to author's primary key (at least in the way django presently implements things), so e.g. the following is way to give authors who aren't translators: Author.objects.exclude(pk__in=Translator.objects.all().values('pk')) -- 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.
Re: Sending email via SMTP in a unit test
On Fri, Apr 23, 2010 at 6:27 PM, Vasil Vangelovski wrote: > Is there a way to run unit tests in such a way that email will be sent > via the SMTP email backend when there's a call to send_mail in the > unit test? In 1.1; no. In 1.1, Django has a single mail API, and the test setup code replaces that API with a mock during setup. The only way to send mail would be to open a Python SMTP connection instead of using Django's mail API. However, in trunk (soon to be 1.2), it is possible. Although the default mail API is still mocked out, you can manually instantiate an SMTP connection. See [1] for more details. [1] http://docs.djangoproject.com/en/dev/topics/email/#obtaining-an-instance-of-an-e-mail-backend Yours, Russ Magee %-) -- 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.
Re: Sending email via SMTP in a unit test
Yes, I'm using trunk (1.2). Thanks Russell, that helped. On Fri, Apr 23, 2010 at 1:59 PM, Russell Keith-Magee wrote: > On Fri, Apr 23, 2010 at 6:27 PM, Vasil Vangelovski > wrote: >> Is there a way to run unit tests in such a way that email will be sent >> via the SMTP email backend when there's a call to send_mail in the >> unit test? > > In 1.1; no. In 1.1, Django has a single mail API, and the test setup > code replaces that API with a mock during setup. The only way to send > mail would be to open a Python SMTP connection instead of using > Django's mail API. > > However, in trunk (soon to be 1.2), it is possible. Although the > default mail API is still mocked out, you can manually instantiate an > SMTP connection. See [1] for more details. > > [1] > http://docs.djangoproject.com/en/dev/topics/email/#obtaining-an-instance-of-an-e-mail-backend > > Yours, > Russ Magee %-) > > -- > 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. > > -- 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.
Re: Should Django handle uploaded files in PUT as well as POST?
This is a somewhat old topic, but a workaround for those (such as myself) who need to process parameters from the request body on non-POST methods (such as PUT) is to write: body_params = QueryDict(request.raw_post_data, encoding=request.encoding) and use this dictionary (body_params) in the same way that you would use request.POST. A similar workaround may be produced for files, but this should be enough for most RESTful API implementations (until we get the official support as discussed before). Cheers Chester > On Jan 18, 12:31 pm, Russell Keith-Magee > wrote: >> On Mon, Jan 18, 2010 at 5:23 PM, Masklinn wrote: >> > On 18 Jan 2010, at 03:04 , Russell Keith-Magee wrote: >> >> >> On Mon, Jan 18, 2010 at 8:14 AM, Malcolm Box >> >> wrote: >> >>> On Sat, Jan 16, 2010 at 4:58 AM, Russell Keith-Magee >> >>> wrote: >> >> On Sat, Jan 16, 2010 at 6:32 AM, Malcolm Box >> wrote: >> >> > It seems to me that Django should process POST and PUT requests the >> > same >> > - >> > i.e. the request.FILES attribute should be initialised for either if a >> > multipart content-type is detected. >> >> > Have I fundamentally misunderstood how this stuff should work? >> -- 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.
Re: form class
On Apr 23, 9:52 am, xpanta wrote: > Hi, > > I wanted to ask if I am somehow "obliged" to use the form class > provided by Django framework. I can see its use on "static" forms (eg. > registration forms or account forms) but most of the forms I write are > "dynamic" (forms that are dynamically created depending on the user, > whith input fields like name="user_product_{{product_id}}">) > > I am new to Django, so I carry some old habits with me. Does the > django's form class provide solutions for more complicated forms? > Should I study it, further? You don't *have to* use forms, you can hand-code all the html to be rendered and do the validation manually. However django forms are not limited to static ones; for an example of how to generate dynamic forms check out http://jacobian.org/writing/dynamic-form-generation/. HTH, George -- 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.
problem with apache and wsgi
hi, using django trunk on svn and the latest ubuntu with python 2.6. The setup is this: MEDIA_ROOT = /home/user/media/ MEDIA_URL = http://mysite/smedia/ apache has: Alias /smedia/ /home/user/media/ the uloaded file is in /home/user/media/images/pic.jpg apache cannot find the file. Page source shows the file as http://mysite/smedia/images/pic.jpg but the apache error log shows: /home/user/mediaimages/pic.jpg not found - note that the '/' between 'media' and 'images' is missing. What can be the cause of this error? -- regards Kenneth Gonsalves Senior Associate NRC-FOSS http://certificate.nrcfoss.au-kbc.org.in -- 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.
Re: form class
On Apr 23, 8:52 am, xpanta wrote: > Hi, > > I wanted to ask if I am somehow "obliged" to use the form class > provided by Django framework. I can see its use on "static" forms (eg. > registration forms or account forms) but most of the forms I write are > "dynamic" (forms that are dynamically created depending on the user, > whith input fields like name="user_product_{{product_id}}">) > > I am new to Django, so I carry some old habits with me. Does the > django's form class provide solutions for more complicated forms? > Should I study it, further? > > Thanks, > Chris You're not obliged to do anything, of course. But Django forms do give you a lot of useful functionality - easy ways to display fields, validate them, redisplay them with errors including the submitted values, automatically create/update model instances based on form values, etc. Why do you need dynamic fields with this particular pattern? What is that you want to achieve? Is this something that can be done with formsets? -- DR. -- 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.
temp url with time limit
Wondering if there is a good way to generate temporary URLs that expire in X days. Would like to email out a URL that the recipient can click to access a part of the site that then is inaccessible via that URL after some time period. Thanks, Faizian -- 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.
Altering Model instance before returning it to the caller?
Greetings, my django app has to read values from 2 external tables: - the first table (log) is a sort of log, with many fields. some of these fields are digit coded (i.e.: 0 = input, 1 = output etc). The keys for the fields lay in the second table; - the second table (codes) is composed of an auto_increment key, the name of a field (relative to table log), the value of a field and the description in english of the value. I already created models from these two tables using manage.py inspectdb (I am using django 1.2). The objects of django representing the rows should be readonly (django acts as a front-end). Is there a way (maybe redefining a method in django.db.models.Model) to return the objects representing rows of table 1, already explicited with the related descriptions of table codes? -- 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.
New with Django
Hi, Last two days i am trying to set up django on my window machine. I had installed 1>python25.msi on d drive(d:/Python25). 2>django at location :D:\Python25\Lib\site-packages\django. It showing a successful message on IP : http://127.0.0.1:8000/ 3>Apache 2.2 4>mod_python-3.3.1.win32-py2.5-Apache2.2.exe Up to here its working fine. But i am not able to configure Apache for python I added following lines in httpd.conf file LoadModule python_module modules/mod_python.so SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE testproject.settings PythonOption django.root /d:/projects/django/testproject PythonDebug On PythonPath "['/d:/projects/django/testproject', '/django'] + sys.path" -- 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.
Re: problem with apache and wsgi
does apache have the rights to open the file and enter the directories smedia and images? On Fri, Apr 23, 2010 at 10:45, Kenneth Gonsalves wrote: > hi, > > using django trunk on svn and the latest ubuntu with python 2.6. The setup is > this: > > MEDIA_ROOT = /home/user/media/ > MEDIA_URL = http://mysite/smedia/ > apache has: > Alias /smedia/ /home/user/media/ > > the uloaded file is in /home/user/media/images/pic.jpg > > apache cannot find the file. Page source shows the file as > http://mysite/smedia/images/pic.jpg > > but the apache error log shows: > /home/user/mediaimages/pic.jpg not found - note that the '/' between 'media' > and 'images' is missing. What can be the cause of this error? > > -- > regards > Kenneth Gonsalves > Senior Associate > NRC-FOSS > http://certificate.nrcfoss.au-kbc.org.in > > -- > 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. > > -- 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.
Re: problem with apache and wsgi
Did you try: Alias /smedia /home/user/media On Fri, Apr 23, 2010 at 2:15 PM, Kenneth Gonsalves wrote: > hi, > > using django trunk on svn and the latest ubuntu with python 2.6. The setup > is > this: > > MEDIA_ROOT = /home/user/media/ > MEDIA_URL = http://mysite/smedia/ > apache has: > Alias /smedia/ /home/user/media/ > > the uloaded file is in /home/user/media/images/pic.jpg > > apache cannot find the file. Page source shows the file as > http://mysite/smedia/images/pic.jpg > > but the apache error log shows: > /home/user/mediaimages/pic.jpg not found - note that the '/' between > 'media' > and 'images' is missing. What can be the cause of this error? > > -- > regards > Kenneth Gonsalves > Senior Associate > NRC-FOSS > http://certificate.nrcfoss.au-kbc.org.in > > -- > 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. > > -- 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.
Re: Altering Model instance before returning it to the caller?
This is pretty standard behavior in Django. Have something like this in your models.py: LOG_CODES = ( ('Input', 1), ('Output', 2), ) Then, the model field should have this in its definition: choices = LOG_CODES If you name that field name, say, _transaction_type, then you can define a function in your model called transaction_type which returns the proper text value for the numeric value. To make things even easier, put an @property decorator right before that function definition, and you can call modelname.transaction_type instead of modelname.transaction_type(). That makes the syntax the same as you would expect for a property of a model. Shawn -- 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.
Re: New with Django
You can write a file xyz.wsgi with following content in your application import os import sys sys.path.append("D:\\workspace\\python\\sspl\\src") sys.path.append("D:\\workspace\\python\\sspl\\src\\ssplsite") os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() and in https.conf you need to add following entry LoadModule python_module modules/mod_python.so and WSGIScriptAlias > Order deny,allow Allow from all I think this should work. Regards Anand www.bootstraptoday.com On Fri, Apr 23, 2010 at 4:38 PM, Mehul wrote: > Hi, > Last two days i am trying to set up django on my window machine. > I had installed > 1>python25.msi on d drive(d:/Python25). > 2>django at location :D:\Python25\Lib\site-packages\django. > It showing a successful message on IP : http://127.0.0.1:8000/ > 3>Apache 2.2 > 4>mod_python-3.3.1.win32-py2.5-Apache2.2.exe > > Up to here its working fine. > > > But i am not able to configure Apache for python > > I added following lines in httpd.conf file > LoadModule python_module modules/mod_python.so > > >SetHandler python-program >PythonHandler django.core.handlers.modpython >SetEnv DJANGO_SETTINGS_MODULE testproject.settings >PythonOption django.root /d:/projects/django/testproject >PythonDebug On >PythonPath "['/d:/projects/django/testproject', '/django'] + > sys.path" > > > -- > 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. > > -- 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.
Re: danjgo authentification
Shouldn't the form in fac_login.html target /login/? ... Even if not, that dot in the action attribute should _not_ be there, I don't think. -- 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.
Re: django files based sessions
See workaround here -> http://code.djangoproject.com/ticket/9084 On 3 апр, 08:10, Pradnya wrote: > I am using windows XP and Python with django > 1. changed the SESSION_ENGINE to > 'django.contrib.sessions.backends.file' > 2. SESSION_FILE_PATH = 'd:/tmp' > 3. In view.py defined 2 methods/views as follows > > def show_login(request): > request.session['test'] = "Hello World" > return render_to_response('login.html') > > def form_submit(request): > return render_to_response('home.html', {'result' : > request.session['test']}) > > On click of test button click from login.html it will call form_submit > view. > > It loads the login.html and also creates session file in d:/tmp but > while > reading the session it throws following error on the browser > > KeyError at /form_submit > stack trace > # C:\Python26\lib\site-packages\django\core\handlers\base.py in > get_response > response = callback(request, *callback_args, **callback_kwargs) > > # D:\PythonSample\mysite\..\mysite\portal\views.py in form_submit > return render_to_response('home.html', {'result' : > request.session['test']}) > > # C:\Python26\lib\site-packages\django\contrib\sessions\backends > \base.py in > __getitem__ > return self._session[key] > > I am using django version 1.1.1, OS Windows xp and python 2.6 > > Please let me know what is wrong here or are there any other changes > need > to be done for file based session. -- 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.
Re: temp url with time limit
Take a look at this Lighttpd module: http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModSecDownload You could implement something based on what the module above is doing. On Apr 23, 12:26 pm, Faizan wrote: > Wondering if there is a good way to generate temporary URLs that > expire in X days. Would like to email out a URL that the recipient can > click to access a part of the site that then is inaccessible via that > URL after some time period. > > Thanks, > Faizian > > -- > 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 > athttp://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.
Re: temp url with time limit
Just create a model that stores the url and the expiration time. If the url is hit past the expiration time, delete it, if it's still within the time limit, display whatever you want to display. Obviously this is for a small system, since you would be waiting to delete until the url is hit, but its quick and easy. To expand on it, make a deletion script that purges all old urls on a set interval, say daily, on a cron job. On Apr 23, 10:07 am, daniels wrote: > Take a look at this Lighttpd > module:http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModSecDownload > You could implement something based on what the module above is doing. > > On Apr 23, 12:26 pm, Faizan wrote: > > > Wondering if there is a good way to generate temporary URLs that > > expire in X days. Would like to email out a URL that the recipient can > > click to access a part of the site that then is inaccessible via that > > URL after some time period. > > > Thanks, > > Faizian > > > -- > > 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 > > athttp://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 > athttp://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.
Re: import request ? - django debugsqlshell
Request is an object that django passes view functions that includes post data, meta data, and data about the request taking place. Not sure what your test function is doing, but to start, python is complaining because you are referencing the variable before it has been declared. You need to define request first. Your function might need some valid request data to work. To start, just declare your request first, request = []. Read up on django's request object here: http://docs.djangoproject.com/en/dev/ref/request-response/ On Apr 22, 5:08 pm, Daxal wrote: > Hi, > > I am trying to run a little debug code before I put it on my > testserver. I am passing in "request" variable in the django code for > the debugsqlshell but it doesn't seem to work. > > >>> sresults=run_search_component(request, 'contacts') > > Traceback (most recent call last): > File "", line 1, in > NameError: name 'request' is not defined > > Anyone know what the command is to import request? I checked many > websites on google and search forums but did not find anything. > > Thanks for you help. > > Daxal > > -- > 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 > athttp://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.
Autocomplete with two tables
Hi everybody ! I have two tables on my database : one for the products (named Product) and one for my clients (name Client). In Client, there is a row named 'products' where I put all the client products with a list and a dictionnary. For exemple : list = ["prod1": {"name"="product1", "price"=2}, "prod2":{"name"="product2", "price"=3}] I want to autocomplete a field with Jquery with the table Product. So I wrote (ok ! copy :p) this function : def lookup_product(request, name): # Default return list results = [] if request.method == "GET": if request.GET.has_key(u'query'): value = request.GET[u'query'] # Ignore queries shorter than length 3 if len(value) > 2: model_results = Product.objects.filter(name__icontains=value) results = [ x.name for x in model_results ] json = simplejson.dumps(results) return HttpResponse(json, mimetype='application/json') However, I want to filter the table Product with all the client products. Does anybody have an idea to do it ? I thought on something like that : add in filter "name is present on list" where list is the client products list. What's your opinion ? Thanks PEP -- 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.
Re: New with Django
Whenever I use django on my windows box, i use XAMPP, which is a all in one installer that gets apache and mysql. So I: - install XAMPP - install python - svn checkout django in the site-packages folder - install mysql bindings for python - install python image library and I think you need to add your python path to the windows paths hope some of that helps. On Apr 23, 9:09 am, Anand Agarwal wrote: > You can write a file xyz.wsgi with following content in your application > > import os > import sys > > sys.path.append("D:\\workspace\\python\\sspl\\src") > sys.path.append("D:\\workspace\\python\\sspl\\src\\ssplsite") > > os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' > > import django.core.handlers.wsgi > application = django.core.handlers.wsgi.WSGIHandler() > > and in https.conf you need to add following entry > > LoadModule python_module modules/mod_python.so > > and > > WSGIScriptAlias > > > Order deny,allow > Allow from all > > > > I think this should work. > > Regards > Anandwww.bootstraptoday.com > > > > > > On Fri, Apr 23, 2010 at 4:38 PM, Mehul wrote: > > Hi, > > Last two days i am trying to set up django on my window machine. > > I had installed > > 1>python25.msi on d drive(d:/Python25). > > 2>django at location :D:\Python25\Lib\site-packages\django. > > It showing a successful message on IP :http://127.0.0.1:8000/ > > 3>Apache 2.2 > > 4>mod_python-3.3.1.win32-py2.5-Apache2.2.exe > > > Up to here its working fine. > > > But i am not able to configure Apache for python > > > I added following lines in httpd.conf file > > LoadModule python_module modules/mod_python.so > > > > > SetHandler python-program > > PythonHandler django.core.handlers.modpython > > SetEnv DJANGO_SETTINGS_MODULE testproject.settings > > PythonOption django.root /d:/projects/django/testproject > > PythonDebug On > > PythonPath "['/d:/projects/django/testproject', '/django'] + > > sys.path" > > > > > -- > > 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 > groups.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 > athttp://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.
Re: temp url with time limit
Another possibility, if you don't care what the url looks like, is to encode the date and a md5 (or other, your choice) checksum in the url. The checksum is formed by putting a 'secret' where the checksum goes (at the end?) and checksuming that. When you get a request back, first check the date, since, if it is expired, there is no need to perform another checksum. If the date is good, do a new checksum of the incoming url with the checksum replaced by the 'secret'. If the result is the same as came in with the request, serve the content, If the sums don't match, the request has been tampered with, treat it as expired. Bill On Fri, Apr 23, 2010 at 10:36 AM, Nick Serra wrote: > Just create a model that stores the url and the expiration time. If > the url is hit past the expiration time, delete it, if it's still > within the time limit, display whatever you want to display. Obviously > this is for a small system, since you would be waiting to delete until > the url is hit, but its quick and easy. To expand on it, make a > deletion script that purges all old urls on a set interval, say daily, > on a cron job. > > On Apr 23, 10:07 am, daniels wrote: >> Take a look at this Lighttpd >> module:http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModSecDownload >> You could implement something based on what the module above is doing. >> >> On Apr 23, 12:26 pm, Faizan wrote: >> >> > Wondering if there is a good way to generate temporary URLs that >> > expire in X days. Would like to email out a URL that the recipient can >> > click to access a part of the site that then is inaccessible via that >> > URL after some time period. >> >> > Thanks, >> > Faizian >> >> > -- >> > 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 >> > athttp://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 >> athttp://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. > > -- 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.
Re: get_next_by title?
On Fri, Apr 23, 2010 at 1:29 AM, ChrisR wrote: > def get_prev_by_title(self): > get_prev = Product.objects.order_by('- > title').filter(title__lt=self.title) > try: > return get_prev[0] > except IndexError: > return None > > > def get_next_by_title(self): > get_next = > Product.objects.order_by('title').filter(title__gt=self.title) > try: > return get_next[0] > except IndexError: > return None just a little DRYer: == take 1 def firstornone (q): try: return q[0] except IndexError: return None . def get_prev_by_title(self): return firstornone(Product.objects.order_by('-title').filter(title__lt=self.title)) def get_next_by_title(self): return firstornone(Product.objects.order_by('title').filter(title__gt=self.title)) or even: take 2 === def next_by (queryset, field, value): return firstornone (queryset.order_by(field).filter(**{'%s__gt'%field:value})) def prev_by (queryset, field, value): return firstornone (queryset.order_by('-'+field).filter(**{'%s__lt'%field:value})) . def get_prev_by_title(self): return prev_by(Product.objects.all(), 'title', self.title) def get_next_by_title(self): return next_by(Product.objects.all(), 'title', self.title) = (a slow morning, i felt the itch to code a little) -- Javier -- 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.
Re: I have a problem with the pagination with haystack and apache solr
What I do here in search_indexes.py is this: from haystack import site from atl_cms.content_type.models import News, Document site.register(News) site.register(Document) On Fri, Apr 23, 2010 at 4:18 AM, Ray McBride wrote: > You should have defined the fields yourself in you search_indexes.py > file in your app > > http://docs.haystacksearch.org/dev/searchindex_api.html#quick-start > > Solr knows about these because you copy your generated schema.xml file > into the conf folder > > Ray > > On Apr 22, 6:46 pm, Ariel wrote: > > I don't know how to know that because I don't know the name of the fields > in > > the index. > > How could I know it ??? > > Regards > > Ariel > > > > > > > > > > > > On Wed, Apr 21, 2010 at 4:40 AM, Ray McBride > wrote: > > > How many results are returned when you search using the solr admin > > > interface? > > > > > Are you using the code that I posted for you previously? > > > > > Ray > > > > > On Apr 19, 6:29 pm, Ariel wrote: > > > > Hi everybody: > > > > I have a big problem with pagination using apache solr and haystack, > this > > > is > > > > what it is happening: I have a site where the news are being indexing > > > with > > > > haystack and solr, but the problem is that when a I make the search > the > > > > pagination is showing me more match results that what really exists > even > > > > more results that total news in my database, for example I have only > 20 > > > news > > > > in the database but when I make a search the pagination said 40 > matching > > > > results are found then when I navigate with the "next" link to see > the > > > other > > > > results any result is showed. > > > > > > I hope I have made a good explanation of my problem. > > > > Could you help me please ??? > > > > I don't know why it is happening that > > > > Regards. > > > > Ariel > > > > > > -- > > > > 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 athttp:// > > > 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. > > > > -- > > 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 athttp:// > 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. > > -- 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.
Re: get_next_by title?
Awesome, even better! Thanks Javier. I'll look into adding this instead, or at least hang onto it for future reference. -- 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.
Re: I have a problem with the pagination with haystack and apache solr
Where does the apache solr save the index ??? On Fri, Apr 23, 2010 at 1:23 PM, Ariel wrote: > What I do here in search_indexes.py is this: > > from haystack import site > from atl_cms.content_type.models import News, Document > > site.register(News) > site.register(Document) > > > > > > On Fri, Apr 23, 2010 at 4:18 AM, Ray McBride wrote: > >> You should have defined the fields yourself in you search_indexes.py >> file in your app >> >> http://docs.haystacksearch.org/dev/searchindex_api.html#quick-start >> >> Solr knows about these because you copy your generated schema.xml file >> into the conf folder >> >> Ray >> >> On Apr 22, 6:46 pm, Ariel wrote: >> > I don't know how to know that because I don't know the name of the >> fields in >> > the index. >> > How could I know it ??? >> > Regards >> > Ariel >> > >> > >> > >> > >> > >> > On Wed, Apr 21, 2010 at 4:40 AM, Ray McBride >> wrote: >> > > How many results are returned when you search using the solr admin >> > > interface? >> > >> > > Are you using the code that I posted for you previously? >> > >> > > Ray >> > >> > > On Apr 19, 6:29 pm, Ariel wrote: >> > > > Hi everybody: >> > > > I have a big problem with pagination using apache solr and haystack, >> this >> > > is >> > > > what it is happening: I have a site where the news are being >> indexing >> > > with >> > > > haystack and solr, but the problem is that when a I make the search >> the >> > > > pagination is showing me more match results that what really exists >> even >> > > > more results that total news in my database, for example I have only >> 20 >> > > news >> > > > in the database but when I make a search the pagination said 40 >> matching >> > > > results are found then when I navigate with the "next" link to see >> the >> > > other >> > > > results any result is showed. >> > >> > > > I hope I have made a good explanation of my problem. >> > > > Could you help me please ??? >> > > > I don't know why it is happening that >> > > > Regards. >> > > > Ariel >> > >> > > > -- >> > > > 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 athttp:// >> > > 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. >> > >> > -- >> > 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 athttp:// >> 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. >> >> > -- 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.
Filtering for an object that is modified in memory loses those modifications?
I have a situation where I have a handle to a db object and I've modified a field in it. Then I later end up executing a filter that finds that same object (among others) and saves all of the objects it finds. In this situation the modified fields do not get saved out. It's like the filter is getting the object directly from the database, as opposed to getting the object that is in memory and modified (but not yet saved). Is this the expected behavior? Margie -- 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.
Performing an action on model.save() but not on update
Hi, I have overridden the default save() on a model so that I can update some counts every time a save occurs. Unfortunately, I don't want to perform these actions every time the model is updated, which seems to happen. Is there another approach I can take that distinguishes between save and update? class Answer(models.Model): answer = models.TextField() user = models.ForeignKey(User, null=True) submit_date = models.DateTimeField('Date Submitted', default=datetime.datetime.now) question = models.ForeignKey(Question) permalink = models.CharField(max_length=300, blank=True) def save(self, *args, **kwargs): super(Answer, self).save(*args, **kwargs) # Call the "real" save() method. if(self.user): quser = self.user.get_profile() quser.increment_answers() # <-- I don't want to do this on an update. self.question.increment_responses() # <-- I don't want to do this either. Or in more readable form: http://dpaste.de/I2IR/ TIA! -Jim -- 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.
Re: Performing an action on model.save() but not on update
On Apr 23, 3:27 pm, Jim N wrote: > Hi, > > I have overridden the default save() on a model so that I can update > some counts every time a save occurs. Unfortunately, I don't want to > perform these actions every time the model is updated, which seems to > happen. > > Is there another approach I can take that distinguishes between save > and update? > > class Answer(models.Model): > answer = models.TextField() > user = models.ForeignKey(User, null=True) > submit_date = models.DateTimeField('Date Submitted', > default=datetime.datetime.now) > question = models.ForeignKey(Question) > permalink = models.CharField(max_length=300, blank=True) > > def save(self, *args, **kwargs): > super(Answer, self).save(*args, **kwargs) # Call the "real" > save() method. > if(self.user): > quser = self.user.get_profile() > quser.increment_answers() # <-- I don't want to do this > on an update. > self.question.increment_responses() # <-- I don't want to > do this either. > > Or in more readable form:http://dpaste.de/I2IR/ > Before you call super you can see if bool(self.pk) is True or False. It will be False before the first save. -- 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.
Re: Filtering for an object that is modified in memory loses those modifications?
Yes. The filter method returns a queryset which is a lazy database object that will query the database to get the queryset. You would have to save the object for the queryset to return it. You could however get all of the objects which are not your select objects MyModel.objects.exclude(pk__in=iterable_of_in_memory_pks_not_to_be_returned) On Apr 23, 3:15 pm, Margie Roginski wrote: > I have a situation where I have a handle to a db object and I've > modified a field in it. Then I later end up executing a filter that > finds that same object (among others) and saves all of the objects it > finds. In this situation the modified fields do not get saved out. > It's like the filter is getting the object directly from the database, > as opposed to getting the object that is in memory and modified (but > not yet saved). > > Is this the expected behavior? > > Margie > > -- > 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 > athttp://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.
auto generate "dummy" content (e.g. Lorem ipsum generator for Django)
Is there any easy way of generating dummy content for models in Django? As I'm learning how to use Django, I often find myself deleting the sqlite database and running syncdb each time (rather than dealing with the issues of manual schema migration each time I make a change to my models). As part of this, I'd like to regenerate some dummy content so I can test the various views and templates quickly. It seems pretty straightforward: the model.*Fields can give the necessary clues as to the content that can be generated. Before I start writing this, I thought I'd check to see if anyone has done something similar. I tried searching for a similar app, but couldn't find anything. Brad -- 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.
Re: Autocomplete with two tables
http://docs.djangoproject.com/en/dev/topics/db/queries/ On Apr 23, 11:11 am, Pep wrote: > Hi everybody ! > > I have two tables on my database : one for the products (named > Product) and one for my clients (name Client). > In Client, there is a row named 'products' where I put all the client > products with a list and a dictionnary. > For exemple : list = ["prod1": {"name"="product1", "price"=2}, > "prod2":{"name"="product2", "price"=3}] > > I want to autocomplete a field with Jquery with the table Product. > So I wrote (ok ! copy :p) this function : > > def lookup_product(request, name): > # Default return list > results = [] > if request.method == "GET": > if request.GET.has_key(u'query'): > value = request.GET[u'query'] > # Ignore queries shorter than length 3 > if len(value) > 2: > model_results = > Product.objects.filter(name__icontains=value) > results = [ x.name for x in model_results ] > json = simplejson.dumps(results) > return HttpResponse(json, mimetype='application/json') > > However, I want to filter the table Product with all the client > products. > > Does anybody have an idea to do it ? > I thought on something like that : add in filter "name is present on > list" where list is the client products list. What's your opinion ? > > Thanks > > PEP > > -- > 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 > athttp://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.
Re: auto generate "dummy" content (e.g. Lorem ipsum generator for Django)
http://docs.djangoproject.com/en/dev/ref/contrib/webdesign/#ref-contrib-webdesign On Apr 23, 3:41 pm, Brad Buran wrote: > Is there any easy way of generating dummy content for models in Django? As > I'm learning how to use Django, I often find myself deleting the sqlite > database and running syncdb each time (rather than dealing with the issues > of manual schema migration each time I make a change to my models). As part > of this, I'd like to regenerate some dummy content so I can test the various > views and templates quickly. It seems pretty straightforward: the > model.*Fields can give the necessary clues as to the content that can be > generated. Before I start writing this, I thought I'd check to see if > anyone has done something similar. I tried searching for a similar app, but > couldn't find anything. > > Brad > > -- > 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 > athttp://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.
Re: Filtering for an object that is modified in memory loses those modifications?
This is correct behavior. You do not have a handle on a db row. You have a reference to an instance of a python class whose attributes contain data copied from the (set of foreign key and/or join table related )db row(s). Filter is a means of preparing a new query to run against the db. When that query is executed (the filter return is evaluated) a new collection of python class instances is created and populated from what the db returns for the query. There is no awareness that you still have a reference to some other instance. The new instance of the class for the particular row will have been populated only from the databases. Changes to that other instance are private to the software holding a reference to it unless and until you call its save() method -- the save method of some other instance such as the one from the latter query, won't do -- at which time the ORM will compose and execute an update query on the database to set the fields in the row according to the attribute values of the instance. Bill On Fri, Apr 23, 2010 at 3:15 PM, Margie Roginski wrote: > I have a situation where I have a handle to a db object and I've > modified a field in it. Then I later end up executing a filter that > finds that same object (among others) and saves all of the objects it > finds. In this situation the modified fields do not get saved out. > It's like the filter is getting the object directly from the database, > as opposed to getting the object that is in memory and modified (but > not yet saved). > > Is this the expected behavior? > > Margie > > -- > 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. > > -- 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.
Re: Filtering for an object that is modified in memory loses those modifications?
Thanks for the clarification Skylar and Bill. That all makes sense. Margie On Apr 23, 12:48 pm, Bill Freeman wrote: > This is correct behavior. You do not have a handle on a db row. > You have a reference to an instance of a python class whose > attributes contain data copied from the (set of foreign key and/or > join table related )db row(s). Filter is a means of preparing a new > query to run against the db. When that query is executed (the > filter return is evaluated) a new collection of python class instances > is created and populated from what the db returns for the query. > There is no awareness that you still have a reference to some other > instance. The new instance of the class for the particular row will > have been populated only from the databases. Changes to that > other instance are private to the software holding a reference to it > unless and until you call its save() method -- the save method of > some other instance such as the one from the latter query, won't > do -- at which time the ORM will compose and execute an update > query on the database to set the fields in the row according to the > attribute values of the instance. > > Bill > > On Fri, Apr 23, 2010 at 3:15 PM, Margie Roginski > > > > wrote: > > I have a situation where I have a handle to a db object and I've > > modified a field in it. Then I later end up executing a filter that > > finds that same object (among others) and saves all of the objects it > > finds. In this situation the modified fields do not get saved out. > > It's like the filter is getting the object directly from the database, > > as opposed to getting the object that is in memory and modified (but > > not yet saved). > > > Is this the expected behavior? > > > Margie > > > -- > > 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 > > athttp://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 > athttp://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.
Oracle cursor.execute problem
Hello. This code works fine: >>> import cx_Oracle >>> lDsn = cx_Oracle.makedsn(lDatabaseHost, int(lDatabasePort), lDatabaseName) >>> lConnectString = "%s/%...@%s" % (lDatabaseUsername, lDatabasePassword, lDsn) >>> lConnection = cx_Oracle.connect(lConnectString) >>> cursor = lConnection.cursor() >>> lOutput = cursor.var(cx_Oracle.STRING) >>> cursor.execute("BEGIN :out := 'N'; END;", {'out' : lOutput}) >>> print lOutput >>> print lOutput.getvalue() N However, if I change this to get the connection from Django, it all falls in a big heap: >>> from django.db import connection >>> cursor = connection.cursor() >>> import cx_Oracle >>> lOutput = cursor.var(cx_Oracle.STRING) >>> cursor.execute("BEGIN :out := 'N'; END;", {'out' : lOutput}) Traceback (most recent call last): File "", line 1, in File "/dev/HEAD/INTERNAL/websites/Wam3\django\db\backends\util.py", line 19, in execute return self.cursor.execute(sql, params) File "/web/djangocourse\django\db\backends\oracle\base.py", line 435, in execute query = convert_unicode(query % tuple(args), self.charset) TypeError: not all arguments converted during string formatting Can anyone point me in the direction of how I can fix this? Cheers, Tim. -- 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.
Re: I have a problem with the pagination with haystack and apache solr
You have no SearchIndex class. see the quick start guide in the link I sent you R On 23 Apr, 18:23, Ariel wrote: > What I do here in search_indexes.py is this: > > from haystack import site > from atl_cms.content_type.models import News, Document > > site.register(News) > site.register(Document) > > > > > > On Fri, Apr 23, 2010 at 4:18 AM, Ray McBride wrote: > > You should have defined the fields yourself in you search_indexes.py > > file in your app > > >http://docs.haystacksearch.org/dev/searchindex_api.html#quick-start > > > Solr knows about these because you copy your generated schema.xml file > > into the conf folder > > > Ray > > > On Apr 22, 6:46 pm, Ariel wrote: > > > I don't know how to know that because I don't know the name of the fields > > in > > > the index. > > > How could I know it ??? > > > Regards > > > Ariel > > > > On Wed, Apr 21, 2010 at 4:40 AM, Ray McBride > > wrote: > > > > How many results are returned when you search using the solr admin > > > > interface? > > > > > Are you using the code that I posted for you previously? > > > > > Ray > > > > > On Apr 19, 6:29 pm, Ariel wrote: > > > > > Hi everybody: > > > > > I have a big problem with pagination using apache solr and haystack, > > this > > > > is > > > > > what it is happening: I have a site where the news are being indexing > > > > with > > > > > haystack and solr, but the problem is that when a I make the search > > the > > > > > pagination is showing me more match results that what really exists > > even > > > > > more results that total news in my database, for example I have only > > 20 > > > > news > > > > > in the database but when I make a search the pagination said 40 > > matching > > > > > results are found then when I navigate with the "next" link to see > > the > > > > other > > > > > results any result is showed. > > > > > > I hope I have made a good explanation of my problem. > > > > > Could you help me please ??? > > > > > I don't know why it is happening that > > > > > Regards. > > > > > Ariel > > > > > > -- > > > > > 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 > > > groups.com> > > > > > > . > > > > > For more options, visit this group athttp:// > > > > 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 > > > groups.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 > groups.com> > > . > > > For more options, visit this group athttp:// > > 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 > groups.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 > athttp://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.
Re: Performing an action on model.save() but not on update
A post save signal seems better suited for this. The post save signal has an attribute 'created' that will be true or false depending on if the object is being created or updated. Check out the post_save documentation: http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.post_save On Apr 23, 3:32 pm, Skylar Saveland wrote: > On Apr 23, 3:27 pm, Jim N wrote: > > > > > > > Hi, > > > I have overridden the default save() on a model so that I can update > > some counts every time a save occurs. Unfortunately, I don't want to > > perform these actions every time the model is updated, which seems to > > happen. > > > Is there another approach I can take that distinguishes between save > > and update? > > > class Answer(models.Model): > > answer = models.TextField() > > user = models.ForeignKey(User, null=True) > > submit_date = models.DateTimeField('Date Submitted', > > default=datetime.datetime.now) > > question = models.ForeignKey(Question) > > permalink = models.CharField(max_length=300, blank=True) > > > def save(self, *args, **kwargs): > > super(Answer, self).save(*args, **kwargs) # Call the "real" > > save() method. > > if(self.user): > > quser = self.user.get_profile() > > quser.increment_answers() # <-- I don't want to do this > > on an update. > > self.question.increment_responses() # <-- I don't want to > > do this either. > > > Or in more readable form:http://dpaste.de/I2IR/ > > Before you call super you can see if bool(self.pk) is True or False. > It will be False before the first save. > > -- > 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 > athttp://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.
Re: form class
Thank you for the answers. The link provided by George is an excellent resource and I should thank him for that. However my task is a bit simpler. Let's say I own a car company and I have dealers in various cities. By clicking on each city name I get a list of cars this city's dealer sells. This list varies from city to city. Also, this list comes as a form where I (as the car company owner) need to write the minimum and maximum selling price for each car and submit it. It is a hypothetical scenario, but my project deals with a very similar problem. in this example is the django's form class approach "better" than the "classic" one (i.e. the one where I use a {% for car in citycars %} loop and attach a car.id and the dealer.id to each input field and process accordingly in the view)? I am new to django, so bear with me if I ask something trivial. Thanks for your time, Chris On 23 Απρ, 11:46, George Sakkis wrote: > On Apr 23, 9:52 am, xpanta wrote: > > > Hi, > > > I wanted to ask if I am somehow "obliged" to use the form class > > provided by Django framework. I can see its use on "static" forms (eg. > > registration forms or account forms) but most of the forms I write are > > "dynamic" (forms that are dynamically created depending on the user, > > whith input fields like > name="user_product_{{product_id}}">) > > > I am new to Django, so I carry some old habits with me. Does the > > django's form class provide solutions for more complicated forms? > > Should I study it, further? > > You don't *have to* use forms, you can hand-code all the html to be > rendered and do the validation manually. However django forms are not > limited to static ones; for an example of how to generate dynamic > forms check outhttp://jacobian.org/writing/dynamic-form-generation/. > > HTH, > George > > -- > 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 > athttp://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.
Re: error with forms
I'm not completely sure, but it looks as though your variable 'body': body = forms.CharField(widget = forms.Textarea()) should be: body = forms.CharField(widget=forms.Textarea) with next area not as a function. http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.Form.widget On Apr 16, 8:14 pm, JoJo wrote: > Hi all, i have an error here im not sure what it means can anyone help > me > > here is my models.py file## > class AddStuffForm(forms.Form): > > title = forms.CharField(max_length=100) > body = forms.CharField(widget = forms.Textarea()) > > def save(self): > new_gossip = Gossip.objects.create(title =['title'], > body =['body']) > > here is my views.py file## > def add_gossip(request): > if request.method == 'POST': > form = AddStuffForm(data=request.POST) > if form.is_valid(): > form.save() > return HttpResponseRedirect("/links/") > else: > form = AddStuffForm() > return render_to_response('add_gossip.html', > { 'form': form}) > > Traceback: > File "c:\Python26\lib\site-packages\django\core\handlers\base.py" in > get_response > 92. response = callback(request, *callback_args, > **callback_kwargs) > File "c:\django\gossip2go\..\gossip2go\applications\views.py" in > add_gossip > 169. form.save() > File "c:\django\gossip2go\applications\models.py" in save > 131. body =['body']) > File "c:\Python26\lib\site-packages\django\db\models\manager.py" in > create > 126. return self.get_query_set().create(**kwargs) > File "c:\Python26\lib\site-packages\django\db\models\query.py" in > create > 314. obj = self.model(**kwargs) > File "c:\Python26\lib\site-packages\django\db\models\base.py" in > __init__ > 323. raise TypeError, "'%s' is an invalid keyword > argument for this function" % kwargs.keys()[0] > > Exception Type: TypeError at /add_gossip/ > Exception Value: 'body' is an invalid keyword argument for this > function > > Thanks in advance > > -- > 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 > athttp://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.
Re: I have a problem with the pagination with haystack and apache solr
usually in a folder called data as defined in the solrconfig.xml but I dont think looking in the data folder will help you. Ray On 23 Apr, 18:32, Ariel wrote: > Where does the apache solr save the index ??? > > > > > > On Fri, Apr 23, 2010 at 1:23 PM, Ariel wrote: > > What I do here in search_indexes.py is this: > > > from haystack import site > > from atl_cms.content_type.models import News, Document > > > site.register(News) > > site.register(Document) > > > On Fri, Apr 23, 2010 at 4:18 AM, Ray McBride wrote: > > >> You should have defined the fields yourself in you search_indexes.py > >> file in your app > > >>http://docs.haystacksearch.org/dev/searchindex_api.html#quick-start > > >> Solr knows about these because you copy your generated schema.xml file > >> into the conf folder > > >> Ray > > >> On Apr 22, 6:46 pm, Ariel wrote: > >> > I don't know how to know that because I don't know the name of the > >> fields in > >> > the index. > >> > How could I know it ??? > >> > Regards > >> > Ariel > > >> > On Wed, Apr 21, 2010 at 4:40 AM, Ray McBride > >> wrote: > >> > > How many results are returned when you search using the solr admin > >> > > interface? > > >> > > Are you using the code that I posted for you previously? > > >> > > Ray > > >> > > On Apr 19, 6:29 pm, Ariel wrote: > >> > > > Hi everybody: > >> > > > I have a big problem with pagination using apache solr and haystack, > >> this > >> > > is > >> > > > what it is happening: I have a site where the news are being > >> indexing > >> > > with > >> > > > haystack and solr, but the problem is that when a I make the search > >> the > >> > > > pagination is showing me more match results that what really exists > >> even > >> > > > more results that total news in my database, for example I have only > >> 20 > >> > > news > >> > > > in the database but when I make a search the pagination said 40 > >> matching > >> > > > results are found then when I navigate with the "next" link to see > >> the > >> > > other > >> > > > results any result is showed. > > >> > > > I hope I have made a good explanation of my problem. > >> > > > Could you help me please ??? > >> > > > I don't know why it is happening that > >> > > > Regards. > >> > > > Ariel > > >> > > > -- > >> > > > 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 >> > > groups.com> > >> > >> > > . > >> > > > For more options, visit this group athttp:// > >> > > 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 >> > > groups.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 >> groups.com> > >> . > >> > For more options, visit this group athttp:// > >> 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 >> groups.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 > athttp://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.
Re: Oracle cursor.execute problem
Looking at the source for execute on django-trunk in django.db.backends.oracle If you have a param, you will have an arg for the query (type: string). http://docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom-sql-directly ... your params should be a list of things to interpolate into the query string, yes? http://docs.python.org/library/stdtypes.html#string-formatting On Apr 23, 3:59 pm, Tim Sawyer wrote: > Hello. > > This code works fine: > > >>> import cx_Oracle > >>> lDsn = cx_Oracle.makedsn(lDatabaseHost, int(lDatabasePort), > lDatabaseName) > >>> lConnectString = "%s/%...@%s" % (lDatabaseUsername, > lDatabasePassword, lDsn) > >>> lConnection = cx_Oracle.connect(lConnectString) > >>> cursor = lConnection.cursor() > >>> lOutput = cursor.var(cx_Oracle.STRING) > >>> cursor.execute("BEGIN :out := 'N'; END;", {'out' : lOutput}) > >>> print lOutput > > >>> print lOutput.getvalue() > N > > However, if I change this to get the connection from Django, it all > falls in a big heap: > > >>> from django.db import connection > >>> cursor = connection.cursor() > >>> import cx_Oracle > >>> lOutput = cursor.var(cx_Oracle.STRIN > >>> cursor.execute("BEGIN :out := 'N'; END;", {'out' : lOutput}) > Traceback (most recent call last): > File "", line 1, in > File "/dev/HEAD/INTERNAL/websites/Wam3\django\db\backends\util.py", > line 19, in execute > return self.cursor.execute(sql, params) > File "/web/djangocourse\django\db\backends\oracle\base.py", line 435, > in execute > query = convert_unicode(query % tuple(args), self.charset) > TypeError: not all arguments converted during string formatting > > Can anyone point me in the direction of how I can fix this? > > Cheers, > > Tim. > > -- > 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 > athttp://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.
Re: Oracle cursor.execute problem
On Apr 23, 1:59 pm, Tim Sawyer wrote: > Hello. > > This code works fine: > > >>> import cx_Oracle > >>> lDsn = cx_Oracle.makedsn(lDatabaseHost, int(lDatabasePort), > lDatabaseName) > >>> lConnectString = "%s/%...@%s" % (lDatabaseUsername, > lDatabasePassword, lDsn) > >>> lConnection = cx_Oracle.connect(lConnectString) > >>> cursor = lConnection.cursor() > >>> lOutput = cursor.var(cx_Oracle.STRING) > >>> cursor.execute("BEGIN :out := 'N'; END;", {'out' : lOutput}) > >>> print lOutput > > >>> print lOutput.getvalue() > N > > However, if I change this to get the connection from Django, it all > falls in a big heap: > > >>> from django.db import connection > >>> cursor = connection.cursor() > >>> import cx_Oracle > >>> lOutput = cursor.var(cx_Oracle.STRING) > >>> cursor.execute("BEGIN :out := 'N'; END;", {'out' : lOutput}) > Traceback (most recent call last): > File "", line 1, in > File "/dev/HEAD/INTERNAL/websites/Wam3\django\db\backends\util.py", > line 19, in execute > return self.cursor.execute(sql, params) > File "/web/djangocourse\django\db\backends\oracle\base.py", line 435, > in execute > query = convert_unicode(query % tuple(args), self.charset) > TypeError: not all arguments converted during string formatting > > Can anyone point me in the direction of how I can fix this? > > Cheers, > > Tim. Hi Tim, Django cursors universally use the 'format' dbapi paramstyle rather than the 'named' style natively used by cx_Oracle [1]. To convert your query, replace the parameter markers with %s and pass the parameters as a list rather than a dictionary. If you instead want to work with the underlying cx_Oracle cursor directly, you can access that as cursor.cursor. However, this is not documented API, so don't expect it to be stable. I'm also not sure whether it works at all with the sqlite3 backend. HTH, Ian [1] http://docs.djangoproject.com/en/1.1/topics/db/sql/#connections-and-cursors -- 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.
Re: Oracle cursor.execute problem
Ah, I guess it's only %s and strings for execute? At anyrate, the third argument to connection.execute(self, query, parms=None), params, is a list of strings, each member of the list should have a '%s' placeholder in the query. The string-formatting link is a not really germane .. On Apr 23, 4:32 pm, Skylar Saveland wrote: > Looking at the source for execute on django-trunk in > django.db.backends.oracle > > If you have a param, you will have an arg for the query (type: > string). > > http://docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom-... > > ... your params should be a list of things to interpolate into the > query string, yes? > > http://docs.python.org/library/stdtypes.html#string-formatting > > On Apr 23, 3:59 pm, Tim Sawyer wrote: > > > > > > > Hello. > > > This code works fine: > > > >>> import cx_Oracle > > >>> lDsn = cx_Oracle.makedsn(lDatabaseHost, int(lDatabasePort), > > lDatabaseName) > > >>> lConnectString = "%s/%...@%s" % (lDatabaseUsername, > > lDatabasePassword, lDsn) > > >>> lConnection = cx_Oracle.connect(lConnectString) > > >>> cursor = lConnection.cursor() > > >>> lOutput = cursor.var(cx_Oracle.STRING) > > >>> cursor.execute("BEGIN :out := 'N'; END;", {'out' : lOutput}) > > >>> print lOutput > > > > >>> print lOutput.getvalue() > > N > > > However, if I change this to get the connection from Django, it all > > falls in a big heap: > > > >>> from django.db import connection > > >>> cursor = connection.cursor() > > >>> import cx_Oracle > > >>> lOutput = cursor.var(cx_Oracle.STRIN > > >>> cursor.execute("BEGIN :out := 'N'; END;", {'out' : lOutput}) > > Traceback (most recent call last): > > File "", line 1, in > > File "/dev/HEAD/INTERNAL/websites/Wam3\django\db\backends\util.py", > > line 19, in execute > > return self.cursor.execute(sql, params) > > File "/web/djangocourse\django\db\backends\oracle\base.py", line 435, > > in execute > > query = convert_unicode(query % tuple(args), self.charset) > > TypeError: not all arguments converted during string formatting > > > Can anyone point me in the direction of how I can fix this? > > > Cheers, > > > Tim. > > > -- > > 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 > > athttp://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 > athttp://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.
Re: Performing an action on model.save() but not on update
Yeah, and I think my suggestion fails for a user-defined rather than auto-incrementing pk. On Apr 23, 4:21 pm, Nick Serra wrote: > A post save signal seems better suited for this. The post save signal > has an attribute 'created' that will be true or false depending on if > the object is being created or updated. Check out the post_save > documentation:http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.si... > > On Apr 23, 3:32 pm, Skylar Saveland wrote: > > > > > > > On Apr 23, 3:27 pm, Jim N wrote: > > > > Hi, > > > > I have overridden the default save() on a model so that I can update > > > some counts every time a save occurs. Unfortunately, I don't want to > > > perform these actions every time the model is updated, which seems to > > > happen. > > > > Is there another approach I can take that distinguishes between save > > > and update? > > > > class Answer(models.Model): > > > answer = models.TextField() > > > user = models.ForeignKey(User, null=True) > > > submit_date = models.DateTimeField('Date Submitted', > > > default=datetime.datetime.now) > > > question = models.ForeignKey(Question) > > > permalink = models.CharField(max_length=300, blank=True) > > > > def save(self, *args, **kwargs): > > > super(Answer, self).save(*args, **kwargs) # Call the "real" > > > save() method. > > > if(self.user): > > > quser = self.user.get_profile() > > > quser.increment_answers() # <-- I don't want to do this > > > on an update. > > > self.question.increment_responses() # <-- I don't want to > > > do this either. > > > > Or in more readable form:http://dpaste.de/I2IR/ > > > Before you call super you can see if bool(self.pk) is True or False. > > It will be False before the first save. > > > -- > > 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 > > athttp://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 > athttp://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.
Re: Oracle cursor.execute problem
On Apr 23, 2:44 pm, Ian wrote: > Django cursors universally use the 'format' dbapi paramstyle rather > than the 'named' style natively used by cx_Oracle [1]. To convert > your query, replace the parameter markers with %s and pass the > parameters as a list rather than a dictionary. > > If you instead want to work with the underlying cx_Oracle cursor > directly, you can access that as cursor.cursor. However, this is not > documented API, so don't expect it to be stable. I'm also not sure > whether it works at all with the sqlite3 backend. One other note: if you just need to call a SP in the database, then you can use cursor.callproc or cursor.callfunc and skirt this entire issue. HTH, Ian -- 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.
Re: Performing an action on model.save() but not on update
I didn't even think of that. It's not very common to be specifying pk's on create anyway, so yours would probably be fine. I just think signals are cleaner and use them when I can :) On Apr 23, 4:47 pm, Skylar Saveland wrote: > Yeah, and I think my suggestion fails for a user-defined rather than > auto-incrementing pk. > > On Apr 23, 4:21 pm, Nick Serra wrote: > > > > > > > A post save signal seems better suited for this. The post save signal > > has an attribute 'created' that will be true or false depending on if > > the object is being created or updated. Check out the post_save > > documentation:http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.si... > > > On Apr 23, 3:32 pm, Skylar Saveland wrote: > > > > On Apr 23, 3:27 pm, Jim N wrote: > > > > > Hi, > > > > > I have overridden the default save() on a model so that I can update > > > > some counts every time a save occurs. Unfortunately, I don't want to > > > > perform these actions every time the model is updated, which seems to > > > > happen. > > > > > Is there another approach I can take that distinguishes between save > > > > and update? > > > > > class Answer(models.Model): > > > > answer = models.TextField() > > > > user = models.ForeignKey(User, null=True) > > > > submit_date = models.DateTimeField('Date Submitted', > > > > default=datetime.datetime.now) > > > > question = models.ForeignKey(Question) > > > > permalink = models.CharField(max_length=300, blank=True) > > > > > def save(self, *args, **kwargs): > > > > super(Answer, self).save(*args, **kwargs) # Call the "real" > > > > save() method. > > > > if(self.user): > > > > quser = self.user.get_profile() > > > > quser.increment_answers() # <-- I don't want to do this > > > > on an update. > > > > self.question.increment_responses() # <-- I don't want to > > > > do this either. > > > > > Or in more readable form:http://dpaste.de/I2IR/ > > > > Before you call super you can see if bool(self.pk) is True or False. > > > It will be False before the first save. > > > > -- > > > 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 > > > athttp://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 > > athttp://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 > athttp://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.
Re: Oracle cursor.execute problem
On Apr 23, 2:45 pm, Skylar Saveland wrote: > Ah, I guess it's only %s and strings for execute? At anyrate, the > third argument to connection.execute(self, query, parms=None), params, > is a list of strings, each member of the list should have a '%s' > placeholder in the query. The string-formatting link is a not really > germane .. Despite the '%s', it's purely a placeholder syntax, not a formatting system. The params don't have to be strings, because they don't actually get interpolated into the query at any point. Ints, floats, datetime objects, and cursor variables all work. Ian -- 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.
Re: SCORM(Sharable Content Object Reference Model) Compliant for Django?
Hi Zeal Django I dont know about a SCORM module for django. As I remember there is a SCORM module for Plone , I dont know about a LMS developed in django. Mario Garcia On Apr 22, 2:05 am, Zeal wrote: > Hi, All, > > Does anyone has the experience on SCORM(Sharable Content Object > Reference Model) support with Django? I want to let my django > application having SCORM support for learning management app. > However, after researching on internet, there is no any post for such > topic. I know that 'moodle' is a greate LMS project with SCORM > support, however it is developed by PHP, not python. Your professional > advice would be highly appreciated! > > Zeal > > -- > 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 > athttp://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.
Re: Performing an action on model.save() but not on update
OK, that makes total sense. I've implemented it like so: def _hook_post_save_answer(instance, sender, **kwargs): if 'created' in kwargs and kwargs['created'] == True: if instance.user: quser = instance.user.get_profile() quser.increment_answers() instance.question.increment_responses() post_save.connect(_hook_post_save_answer, sender=Answer) http://dpaste.de/897o/ But now, it increments TWICE! Is there some glaring error in my logic above? On Apr 23, 4:50 pm, Nick Serra wrote: > I didn't even think of that. It's not very common to be specifying > pk's on create anyway, so yours would probably be fine. I just think > signals are cleaner and use them when I can :) > > On Apr 23, 4:47 pm, Skylar Saveland wrote: > > > > > Yeah, and I think my suggestion fails for a user-defined rather than > > auto-incrementing pk. > > > On Apr 23, 4:21 pm, Nick Serra wrote: > > > > A post save signal seems better suited for this. The post save signal > > > has an attribute 'created' that will be true or false depending on if > > > the object is being created or updated. Check out the post_save > > > documentation:http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.si... > > > > On Apr 23, 3:32 pm, Skylar Saveland wrote: > > > > > On Apr 23, 3:27 pm, Jim N wrote: > > > > > > Hi, > > > > > > I have overridden the default save() on a model so that I can update > > > > > some counts every time a save occurs. Unfortunately, I don't want to > > > > > perform these actions every time the model is updated, which seems to > > > > > happen. > > > > > > Is there another approach I can take that distinguishes between save > > > > > and update? > > > > > > class Answer(models.Model): > > > > > answer = models.TextField() > > > > > user = models.ForeignKey(User, null=True) > > > > > submit_date = models.DateTimeField('Date Submitted', > > > > > default=datetime.datetime.now) > > > > > question = models.ForeignKey(Question) > > > > > permalink = models.CharField(max_length=300, blank=True) > > > > > > def save(self, *args, **kwargs): > > > > > super(Answer, self).save(*args, **kwargs) # Call the "real" > > > > > save() method. > > > > > if(self.user): > > > > > quser = self.user.get_profile() > > > > > quser.increment_answers() # <-- I don't want to do this > > > > > on an update. > > > > > self.question.increment_responses() # <-- I don't want to > > > > > do this either. > > > > > > Or in more readable form:http://dpaste.de/I2IR/ > > > > > Before you call super you can see if bool(self.pk) is True or False. > > > > It will be False before the first save. > > > > > -- > > > > 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 > > > > athttp://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 > > > athttp://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 > > athttp://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 > athttp://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.
Re: Performing an action on model.save() but not on update
Try this out and see what happens: def _hook_post_save_answer(instance, created, sender, **kwargs): if created: if instance.user: quser = instance.user.get_profile() quser.increment_answers() instance.question.increment_responses() post_save.connect(_hook_post_save_answer, sender=Answer) On Apr 23, 6:20 pm, Jim N wrote: > OK, that makes total sense. > > I've implemented it like so: > > def _hook_post_save_answer(instance, sender, **kwargs): > if 'created' in kwargs and kwargs['created'] == True: > if instance.user: > quser = instance.user.get_profile() > quser.increment_answers() > instance.question.increment_responses() > > post_save.connect(_hook_post_save_answer, sender=Answer) > > http://dpaste.de/897o/ > > But now, it increments TWICE! > > Is there some glaring error in my logic above? > > On Apr 23, 4:50 pm, Nick Serra wrote: > > > > > I didn't even think of that. It's not very common to be specifying > > pk's on create anyway, so yours would probably be fine. I just think > > signals are cleaner and use them when I can :) > > > On Apr 23, 4:47 pm, Skylar Saveland wrote: > > > > Yeah, and I think my suggestion fails for a user-defined rather than > > > auto-incrementing pk. > > > > On Apr 23, 4:21 pm, Nick Serra wrote: > > > > > A post save signal seems better suited for this. The post save signal > > > > has an attribute 'created' that will be true or false depending on if > > > > the object is being created or updated. Check out the post_save > > > > documentation:http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.si... > > > > > On Apr 23, 3:32 pm, Skylar Saveland wrote: > > > > > > On Apr 23, 3:27 pm, Jim N wrote: > > > > > > > Hi, > > > > > > > I have overridden the default save() on a model so that I can update > > > > > > some counts every time a save occurs. Unfortunately, I don't want > > > > > > to > > > > > > perform these actions every time the model is updated, which seems > > > > > > to > > > > > > happen. > > > > > > > Is there another approach I can take that distinguishes between save > > > > > > and update? > > > > > > > class Answer(models.Model): > > > > > > answer = models.TextField() > > > > > > user = models.ForeignKey(User, null=True) > > > > > > submit_date = models.DateTimeField('Date Submitted', > > > > > > default=datetime.datetime.now) > > > > > > question = models.ForeignKey(Question) > > > > > > permalink = models.CharField(max_length=300, blank=True) > > > > > > > def save(self, *args, **kwargs): > > > > > > super(Answer, self).save(*args, **kwargs) # Call the "real" > > > > > > save() method. > > > > > > if(self.user): > > > > > > quser = self.user.get_profile() > > > > > > quser.increment_answers() # <-- I don't want to do > > > > > > this > > > > > > on an update. > > > > > > self.question.increment_responses() # <-- I don't want > > > > > > to > > > > > > do this either. > > > > > > > Or in more readable form:http://dpaste.de/I2IR/ > > > > > > Before you call super you can see if bool(self.pk) is True or False. > > > > > It will be False before the first save. > > > > > > -- > > > > > 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 > > > > > athttp://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 > > > > athttp://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 > > > athttp://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 > > athttp://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
Re: DKIM Email
Looking over this snippet, I see that it's set up to use the SMTP backend. Will it also work for the other email backends, or is that asking too much? On Apr 23, 12:13 am, mjlissner wrote: > This snippet looks just about right, and the timing of Atwood's post > was perfect for me, as I am building such a system right now. I'll > post over on the snippet if I discover any problems getting the code > to work. > > Thanks for putting this together. > > On Apr 21, 8:16 pm, Simon Meers wrote: > > > For anyone else who learned aboutDKIMrecently [1], I've uploaded a > > snippet for aDKIM-signing email backend [2]. > > > [1]http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-em... > > [2]http://www.djangosnippets.org/snippets/1995/ > > > -- > > 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 > > athttp://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 > athttp://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.
Re: SCORM(Sharable Content Object Reference Model) Compliant for Django?
I was about to need to do something along these lines, so I used inspectdb to look at Moodle. I was going to connect django and moodle to the same DB since moodle was going to be a certainty in the position that I didn't end up taking: http://github.com/skyl/django-moodle This is a really basic, early, no momentum, old project. http://bitbucket.org/nautilebleu/django-scorm-rest-rte/src might be more interesting. On Apr 22, 5:05 am, Zeal wrote: > Hi, All, > > Does anyone has the experience on SCORM(Sharable Content Object > Reference Model) support with Django? I want to let my django > application having SCORM support for learning management app. > However, after researching on internet, there is no any post for such > topic. I know that 'moodle' is a greate LMS project with SCORM > support, however it is developed by PHP, not python. Your professional > advice would be highly appreciated! > > Zeal > > -- > 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 > athttp://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.