Re: offtopic: delete *.pyc from subversion
Kenneth Gonsalves wrote: >> when I do "svn diff" the pyc-files are still listed. >> guess I have to delete that files from the repository first. right? > > svn remove will delete the files on the next commit adding things to global-ignores does *not* affect files that are already checked 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM
On 11/30/06, Rob Hudson <[EMAIL PROTECTED]> wrote: > > > I think for those who need aggregate data these would cover a lot of > ground. I'd be willing to work on a patch if this is considered > generally useful and we can work out what the API should look like. > > 1 - I'm agreed on the need for easier access to aggregates. Truth be told, aggregates are the reason I got involved with Django in the first place. However, other priorities have arisen in the meantime, so I haven't got around to doing anything about them. 2 - Keep in mind that Malcolm has been working on refactoring django.db.models.query. Until this refactor is committed, we are trying to minimize the number of large changes to query.py. 3 - Also keep in mind that one of the goals of the SQLAlchemy branch is to make complex aggregates (such as those requiring group_by and having) easier to represent. That said, there doesn't appear to have been a lot of progress on this branch (at least, not in public commits, anyway). 4 - If you search the archives (user and developer), you will find several discussions on aggregate functions. group_by() and having() (or pre-magic-removal analogs thereof) have been rejected previously on the grounds that the Django ORM is not intended to be 'SQL with a different syntax'. Any proposal for group_by/having will have to be logical from a Django ORM point of view, and not presuppose/require knowledge of how SQL formulates queries. 5 - The aggregates you suggest are the quick and obvious method for getting aggregates into the query language. However, here are some issues to consider: Article.objects.count() return an integer that is the count of all author objects. This makes sense, and syntactically parses the same way that it operates. However, what does Article.objects.max('pagecount') return? The integer that is the largest page count, or the Article that has the largest pagecount? If it is the former, how do you use the maximum value to get the Article with that maximum value in a single query? If it is the latter, does it return a single object, or a queryset that evaluates to an object? What happens if there are two objects with the same maximum pagecount? How do you get multiple aggregates for a value in a single query (efficiency matters)? How does the simple case fit into the big picture? Ideally, the simple min() would be a degenerate case of the min-with-group by-and-having. Prove to me that adding min(), max(), etc isn't going to become a wart that we have to support into the future when 'aggregate clauses 3000' is added to Django's query syntax. So, as you can see - it's not as simple as 'just add a min() where count() is already'. Like I said at the beginning, I'm keen to see aggregates implemented - I just want to see them done right. There are many things that _could_ be done to implement aggregates; whether they are the _right_ thing to do is another matter entirely. I'm open to any discussion on this issue, and would be happy to help shepard any patches resulting from the discussion into the trunk. 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
RE: utf-8 with MySQL
> On Behalf Of Aidas Bendoraitis > I guess, this query may help you: > ALTER DATABASE `yourdatabase` DEFAULT CHARACTER SET utf8 > COLLATE utf8_general_ci So that's how to do it. Thanks! Regards, Ryan Ginstrom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Initial data for models splitted across multiple files
On 11/29/06, Mikko Suniala <[EMAIL PROTECTED]> wrote: > > > I did a quick search but found nothing about this issue. I have splitted > my models across multiple files as described in > http://code.djangoproject.com/wiki/CookBookSplitModelsToFiles. The manager > action "sqlinitialdata" did not seem to find my sql files. After some > investigation I found out that the manager application is searching for > files with a path like /models/sql/.sql rather than > /sql/.sql (as is the case when a single model file > (models.py) is used). > > Is this a bug or is it just me? Sounds like a bug in the way that manage.py discovers the module in which the sql files are located. This is entirely possible, as the 'split models across files' approach isn't the common use case for Django models. 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ManyRelatedManager object in templates
On 11/29/06, conrad22 <[EMAIL PROTECTED]> wrote: > eg. I have the following error appearing, instead of the object: > > django.db.models.fields.related.ManyRelatedManager object What you're missing is the 'all()' at the end. Your example is a little confusing - the model Category should have an attribute organisation that relates to Organisation, not an attribute category that relates to Organisation. However, using your models as written: mycategory.category will return a ManyRelatedManager object. mycategory.category.all() will return the list of instances. You could also filter the results: mycategory.category.filter(product__startswith='foo') would return all the related Organisations that have a product attribute starting with 'foo'. 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Populating select field in custom manipulator
I am trying to use a customer manipulator to build a search screen. One of my fields is a select field but I get an error to many values to unpack. Any help would be greatly appreciated. views.py class SearchResults(forms.Manipulator): def __init__(self): projects = ['Gen2', 'CRMC'] self.fields = ( forms.TextField(field_name="resultsid"), forms.TextField(field_name="testname", length=30), forms.TextField(field_name="startdate"), forms.TextField(field_name="enddate"), forms.TextField(field_name="submitdate"), forms.TextField(field_name="submitenddate"), forms.TextField(field_name="owner"), forms.SelectField(field_name="project", choices=projects), } def create_results(request): manipulator = Results.AddManipulator() if request.method == 'POST': # If data was POSTed, we're trying to create a new Results. new_data = request.POST.copy() # Check for errors. errors = manipulator.get_validation_errors(new_data) if not errors: # No errors. This means we can save the data! manipulator.do_html2python(new_data) new_results = manipulator.save(new_data) # Redirect to the object's "edit" page. Always use a redirect # after POST data, so that reloads don't accidently create # duplicate entires, and so users don't see the confusing # "Repost POST data?" alert box in their browsers. return HttpResponseRedirect("/results/edit/%i/" % new_results.id) else: # No POST, so we want a brand new form without any data or errors. errors = new_data = {} # Create the FormWrapper, template, context, response. form = forms.FormWrapper(manipulator, new_data, errors) return render_to_response('results/create_form.html', {'form': form}) Thanks, Jeff --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Database question
I am working on a church site that will have multiple areas. There will be pages for each of the different ministries like music, singles, students, etc. I am wanting a blog like function for each of these pages where the responsible people will be able to log in to the admin site and add news to their page. My question is would it be better to create a separate table for each of the pages or a single on and then add a ministry field that would be filled in and then use a filter to show the correct information on each page? Here are my thoughts and correct me if I am wrong. 1) If it is all in one table then doing a search for information on the entire site would be easier. 2) If they are separated then adding a new page later would be done by just adding a new class to the model.py. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Database question
I am working on a church site that will have multiple areas. There will be pages for each of the different ministries like music, singles, students, etc. I am wanting a blog like function for each of these pages where the responsible people will be able to log in to the admin site and add news to their page. My question is would it be better to create a separate table for each of the pages or a single on and then add a ministry field that would be filled in and then use a filter to show the correct information on each page? Here are my thoughts and correct me if I am wrong. 1) If it is all in one table then doing a search for information on the entire site would be easier. 2) If they are separated then adding a new page later would be done by just adding a new class to the model.py. -- Thanks, Eric Lake --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Re: accumulating a query filter
On 11/29/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > add leaving out '()' in a function without arguments and you are done Nah, I don't do enough Ruby to get into that habit. Besides, my free time these days (free time! Ha!) is mostly spent playing with Lisp (and a little OCaml), which means I sometimes have the opposite problem with parentheses... -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: accumulating a query filter
On 30-Nov-06, at 1:04 AM, James Bennett wrote: > I leave off * and ** by accident all the time. That and commas in > single-element tuples are probably 90% of the stupid Python mistakes I > make. add leaving out '()' in a function without arguments and you are done -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: offtopic: delete *.pyc from subversion
On 30-Nov-06, at 12:19 AM, patrick k. wrote: > hmm, that doesn´t really change anything. > > when I do "svn diff" the pyc-files are still listed. > guess I have to delete that files from the repository first. right? svn remove will delete the files on the next commit -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM
On Nov 29, 2:30 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > > I needed aggregates. (I also learned about data bubbles and redesigned > > my tables to include them as necessary. This redesign eliminated almost > > all of my needs for an aggregate function interface.)Whatsa data bubble? > > Google and Wikipedia don't seem to know... google search: "data bubble" database --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How to preload all object fields for a QuerySet? (GenericForeignKey and select_related())
Hello, is there a way to force the django db model to load all fields for a particular model _including_ any generic foreign keys (it doesn't seem to do this by default). Currently: Account.objects.select_related() will load all 'simple' fields like IntegerField, CharField, etc, but not GenericForeignKey. Another problem is that I find if I create a OneToOneField link to the default django.contrib.auth.User model (from my Account model), everytime I access request.user.account it is hitting the db to select the account record. How to avoid this/cache this. Thanks for any input. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
django model question about FileField
Hi all I ve got situation like this, I 'm writing a photograph's gallery where photo should be stored on disk in folders like this \\\ At the moment of creation Photo object I know album that foto belongs to and I know the photographer but I can't to implement path to upload_to option. How to do this? It looks like I should write a method that override a column option but I don't know how. Thans for any help Gregor --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to get request.user in templatetag?
Sorry, that was a stupid question, context['request'].session contains the 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: offtopic: delete *.pyc from subversion
Rob Hudson wrote: > Yes, I guess I should have said "And tell subversion to ignore them." if you read the original message again, you'll notice that the OP had already done that. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Add 8 hours from datetime before storing in db?
[EMAIL PROTECTED] wrote: > I am using this code to parse a datetime supplied by magnolia's api > into a valid Python DateTime: > > datetime(*(time.strptime(link("created").replace("-08:00", > "").replace("-07:00", ""), "%Y-%m-%dT%H:%M:%S")[0:6])) note that local variables are very cheap in Python, so you don't really save much by insisting on writing it all on one very long line. (also note that the datetime class has a strptime constructor) > How could I alter this so that it adds 8 hours onto the datetime before > storing it in the db? add datetime.timedelta(hours=8) to the datetime object. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Add 8 hours from datetime before storing in db?
On 11/29/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > How could I alter this so that it adds 8 hours onto the datetime before > storing it in the db? datetime.timedelta. Sample code: >>> import datetime >>> dt = datetime.datetime.now() >>> dt datetime.datetime(2006, 11, 29, 16, 7, 49, 953205) >>> dt + datetime.timedelta(hours=8) datetime.datetime(2006, 11, 30, 0, 7, 49, 953205) -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Add 8 hours from datetime before storing in db?
Hey Everyone, I am using this code to parse a datetime supplied by magnolia's api into a valid Python DateTime: datetime(*(time.strptime(link("created").replace("-08:00", "").replace("-07:00", ""), "%Y-%m-%dT%H:%M:%S")[0:6])) How could I alter this so that it adds 8 hours onto the datetime before storing it in the db? Many Thanks in Advance, Oliver --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to get request.user in templatetag?
But how do you access the session dictionary from a templatetag? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
using manipulators without defining fields again
I'm writing an application form, an application for a workshop. User registration is required and people can start and continue the application process, essential create and edit their application data until the deadline is reached. The form is just one part of a web site, and it has 70 or so fields. I don't think generic views will work for me because 1) I want to save the application even if it doesn't validate. Instead set a flag in the db that the application is not complete. 2) Use data from their site registration to populate parts of the form. So i'm trying to avoid writing a manipulator where i have to re-define all the fields. My only experience with writing manipulators is the registration form, which looks like http://dpaste.com/3315/ . A basic deviation from the documentation example http://www.djangoproject.com/documentation/forms/#custom-forms-and-manipulators . I was told in IRC to extend AutomaticManipulator. But I don't really know what this means in terms of Django/Python code. Does anyone have an example? Since this is probably beyond a Django first-timer, any other suggestions? TIA --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Apache auto-reload?
Hi, I'm developing a site locally, and managing its code and static data in a subversion repository. I also have it running on a real apache server on the web with mod_python, but I don't want to login to the server, restart, etc. every time I check something in. I've got a post-commit hook already updating the server's copy of the site code, and I'm guess I'm going to have to add apache.sh gracefulstop # if models were changed, then: # something to wipe out invalidated tables from the database python manage.py syncdb apache.sh start unless someone has a better suggestion. Is this a problem someone out there has already solved? Thanks in advance, -- Dave Abrahams Boost Consulting www.boost-consulting.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py can't see project
I can't run manage.py shell... can't run manage.py anything without it throwing the importError. I printed sys.path and didn't see anything odd, but I don't really know what I'd be looking for. Here's what I get: ['', '/home2/baxter/lib/python2.4', '/usr/local/lib/python2.4/site-packages/setuptools-0.6c3-py2.4.egg', '/usr/local/lib/python24.zip', '/usr/local/lib/python2.4', '/usr/local/lib/python2.4/plat-linux2', '/usr/local/lib/python2.4/lib-tk', '/usr/local/lib/python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages', '/usr/local/lib/python2.4/site-packages/PIL'] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM
> I needed aggregates. (I also learned about data bubbles and redesigned > my tables to include them as necessary. This redesign eliminated almost > all of my needs for an aggregate function interface.) Whatsa data bubble? Google and Wikipedia don't seem to know... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py can't see project
I'd start with "manage.py shell" and "import sys; print sys.path" to look for anything unusual. -jag On Tue, 2006-11-28 at 21:19 +, [EMAIL PROTECTED] wrote: > Yup... like I said, the models and templates and all appear to see it > no problem. It's looks like it's just manage.py that's not seeing it. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: offtopic: delete *.pyc from subversion
patrick k. wrote: > when I do "svn diff" the pyc-files are still listed. > guess I have to delete that files from the repository first. right? Yes, I guess I should have said "And tell subversion to ignore them." Once you set Subversion to ignore *.pyc, they won't be added anymore. But if you currently have some in there you'll have to "svn rm" them. -Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Updating and saving a related record. How does it work?
I am finding that the following intermediate step is required. Comp=Promo.competition This changes the class from Promotion to Competition and I can then make the changes Comp.total_value=3000 Comp.save() However, I'm no wiser why the earlier solution by Jacob is not working for me. Intuitively, it should. MerMer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py can't see project
Anyone? I'm wondering if it's a pythonpath issue, but don't really know how to check (or fix). I found one thread that suggested adding the project to sys.path within manage.py, but that didn't help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Re: accumulating a query filter
On 11/29/06, Bill de hOra <[EMAIL PROTECTED]> wrote: > I was passing it in without the **; arrhhh :) I leave off * and ** by accident all the time. That and commas in single-element tuples are probably 90% of the stupid Python mistakes I make. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Re: Retrieve Password
On 11/29/06, Clint74 <[EMAIL PROTECTED]> wrote: > I will try this approach. Take a look at the view 'django.contrib.auth.views.password_reset', which should do what you need. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Retrieve Password
On Nov 29, 2006, at 10:50 AM, Clint74 wrote: > > Hi, > > I need to send the password to the user(email), but how recover the > raw > password once the database stores in this format: > > hashType$salt$hash > sha1$6070e$d3a0c5d565deb4318ed607be9706a98535ec7968 You cannot recover the password once it is hashed. If you need to send the password back to the user, you need to store it somewhere yourself. Note that this is not recommended and defeats the purpose of hashed passwords. Don --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: accumulating a query filter
James Bennett wrote: > Doing NodeEvent.objects.filter(**kwargs) should work ^^ I was passing it in without the **; arrhhh anyway this the idiom I ended up with for a different model: [[[ if request.has_key('q'): # GET form new_data = request.GET.copy() errors = manip.get_validation_errors(new_data) if not errors: kwargs ={} # filter strings for key in ["sref","seqno","seqno","mid", "cid"]: val = request[key] if val.strip() != "": kwargs["%s__exact"%key]=val # filter choices/fks: -1 means 'any' for key in ["role","source","dest","mtype"]: val = request[key] if val.strip() != "" and val.strip() != "-1": kwargs["%s__exact"%key]=int(val) results = Message.objects.filter(**kwargs) print "results: ", results ... ]]] cheers Bill --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Retrieve Password
On 11/29/06, Clint74 <[EMAIL PROTECTED]> wrote: > I need to send the password to the user(email), but how recover the raw > password once the database stores in this format: It's not possible to recover the original password once it's been hashed and stored. Django does provide password reset functionality, though. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Retrieve Password
> One generally has a facility to reset the password by > ... > The user can then log in with the new password, > and be directed to change it to a known password. I will try this approach. Thanks everybody --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Retrieve Password
Thank´s Jacob, I missed something indeed. Regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Retrieve Password
On 11/29/06, Clint74 <[EMAIL PROTECTED]> wrote: > I need to send the password to the user(email), but how recover the raw > password once the database stores in this format: > > hashType$salt$hash > sha1$6070e$d3a0c5d565deb4318ed607be9706a98535ec7968 You can't, and that's the point of storing a secure hash. If your DB was compromised, the damage would be limited because access to the password is not possible. As a practical matter, the usual approach with this is to generate a new password and email that one to the user. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Retrieve Password
On 11/29/06 12:50 PM, Clint74 wrote: > I need to send the password to the user(email), but how recover the raw > password once the database stores in this format: You can't; that's the point of hashing it. The right (read: secure) way to deal with this is to *reset* the user's password (usually to something random, which they then can change when they log in) rather than sending their password in plaintext. Jacob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Retrieve Password
You cannot retrieve the raw password, that's the whole point of hashing it :) If you want to store the raw password somewhere, make a raw_password field and store it there, although your users might not be too happy that you're storing their passwords in an easily pilfered format. Clint On 11/29/06, Clint74 <[EMAIL PROTECTED]> wrote: > > Hi, > > I need to send the password to the user(email), but how recover the raw > password once the database stores in this format: > > hashType$salt$hash > sha1$6070e$d3a0c5d565deb4318ed607be9706a98535ec7968 > > Tk´s > > André Duarte > > > > > -- Clint Ecker http://phaedo.cx 312.863.9323 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM
I created such a patch last spring during the Django sprint at PyCon. The basic interface was very straightforward but there was also a slightly less straightforward interface option that allowed for grouping and so forth. The patch was discarded, however, since some of the core Django developers wanted to chime in on the interface design for aggregate functions, but felt they didn't have time to do so until after 0.95 was complete. Rather than fight for my design (which I was not particularly passionate about anyway), I just went home and used plain old SQL when I needed aggregates. (I also learned about data bubbles and redesigned my tables to include them as necessary. This redesign eliminated almost all of my needs for an aggregate function interface.) I am still interested in this topic, but I haven't had the personal bandwidth to stay on top of the Django Developer's group. It would be nice to know what, if anything, is happening along these lines. I might even be willing to spend some time on this during the holidays. Rock Howard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Retrieve Password
> I need to send the password to the user(email), but how recover the raw > password once the database stores in this format: > > hashType$salt$hash > sha1$6070e$d3a0c5d565deb4318ed607be9706a98535ec7968 Hashing is generally a one-way process (like making hamburger out of cow) that prevents figuring out the password from the resulting hash. You can try to run a program like "crack" to determine what the source password was...if it was a facile password, this can do the trick. However, the better the original password, the more time this takes though, and there's no guarantee that the password was not some loony 50-character string of random line-noise that would take years to crack. One generally has a facility to reset the password by giving a new password (or auto-generating it randomly) and then sending the plaintext new password to the user, and storing the resulting hash in the DB. The user can then log in with the new password, and be directed to change it to a known password. -tkc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: offtopic: delete *.pyc from subversion
hmm, that doesn´t really change anything. when I do "svn diff" the pyc-files are still listed. guess I have to delete that files from the repository first. right? thanks, patrick Am 29.11.2006 um 18:42 schrieb Rob Hudson: > > Or tell Subversion to ignore them. > > You should have a file: ~/.subversion/config (on Mac or Linux, not > sure > where it is on Windows) > > In that file under the header "[miscellany]" there's a "global- > ignores" > setting. Just add *.pyc to that list. > > -Rob > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Retrieve Password
not possible, I think. solutions: 1. send the password before you save the user 2. store the raw password somewhere (not so good) patrick Am 29.11.2006 um 19:50 schrieb Clint74: > > Hi, > > I need to send the password to the user(email), but how recover the > raw > password once the database stores in this format: > > hashType$salt$hash > sha1$6070e$d3a0c5d565deb4318ed607be9706a98535ec7968 > > Tk´s > > André Duarte > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Updating and saving a related record. How does it work?
Jacob, I had tried that, but it's not working for me.I get the following:- Promo=Promotion.objects.get(id=1) Promo.competition.total_value >> 2000 Promo.competition.total_value=3000 Promo.competition.save() Promo.competition.total_value >> 2000 I must be doing something stupid, but can't see it. MerMer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Retrieve Password
Hi, I need to send the password to the user(email), but how recover the raw password once the database stores in this format: hashType$salt$hash sha1$6070e$d3a0c5d565deb4318ed607be9706a98535ec7968 Tk´s André Duarte --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: accumulating a query filter
I don't know if this helps, or is exactly what your trying to avoid, but I've done something like this before (based on your example): if use_sources: qSource = Q(source_time__range=(start_date, end_date)) else: qSource = Q(id__gt=0) if use_level: qLevel = Q(level__exact=level) else: qLevel = Q(id__gt=0) results = NodeEvent.objects.filter(qSource & qLevel) The idea is to build up a query with Q objects - and default to showing all (id__gt=0) It's still more complicated then going straight from the request variables to a query, but it works for me. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Updating and saving a related record. How does it work?
On 11/29/06 11:31 AM, MerMer wrote: > However, I can't work out how to save a different value to the field > using something like > > Promotion.competition.total_value=3000 Promotion.competition.save() Jacob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
django model question for small library
Hello! I am writing small app for online library with full text seach. I have all books (less than 25) in html files for every chapter with only and tags, filenames look like book1-4.html and so on. Can somebody suggeest how models.py should looks? Should I insert chapters to database or keep in files (remembering about full-text search)? Thanks. -- Всего наилучшего! Григорий greg [at] anastasia [dot] ru Письмо отправлено: 2006/11/29 20:58 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: offtopic: delete *.pyc from subversion
Or tell Subversion to ignore them. You should have a file: ~/.subversion/config (on Mac or Linux, not sure where it is on Windows) In that file under the header "[miscellany]" there's a "global-ignores" setting. Just add *.pyc to that list. -Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Updating and saving a related record. How does it work?
I was able to save a record like so... Promotion.total_value=2000 Promotion.save() However, I recently moveed the "total_value" field into another model which has a OneToOne relationship with the Promotion Model. Know I can access total_value like so:- Promotion.competition.total_value >> 2000 However, I can't work out how to save a different value to the field using something like Promotion.competition.total_value=3000 Can anybody please advice. Cheers MerMer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Re: manage.py webserver
On 11/29/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > After much googling, I found that if there is no data in the tables, it > produces a 404 error. That's not quite correct; if there's nothing which matches the conditions of the QuerySet you pass to the generic view, and if the 'allow_empty' argument to the QuerySet is False (which is the default), then it will throw a 404. This means, for example, that if you add an object, then the 'list_detail.object_list' view will start showing that object instead of a 404, but if the date field on that object is November, and you use the 'date_based.archive_month' view for any other month, you'll still get a 404 (because there aren't any objects yet for other months). The documentation for the generic views spells this out: "allow_empty: A boolean specifying whether to display the page if no objects are available. If this is False and no objects are available, the view will raise a 404 instead of displaying an empty page. By default, this is False." -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: accumulating a query filter
On 11/29/06, Bill de hOra <[EMAIL PROTECTED]> wrote: > something like this: > > [[[ > if use_sources: >kwargs['sources']= request.GET.getlist('sources') > if use_level: >kwargs['level'] =request.GET['level'] > ... > results = NodeEvent.objects.filter(kwargs) > ]]] Doing NodeEvent.objects.filter(**kwargs) should work, that's how a bunch of the generic views build up their filter arguments (and it's a darned useful convention, too). -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
accumulating a query filter
Hi, Suppose you have 2 fields in a query form, both of which are optional. Is there an idiom for building a dictionary to pass into objects.filter() instead of checking the permutations? eg instead of crazy stuff like this: [[[ if use_sources and use_level: results = NodeEvent.objects.filter( source_time__range=(start_date, end_date), level__exact=level, source__in=sources) elif use_sources and not use_level: results = NodeEvent.objects.filter( source_time__range=(start_date, end_date), source__in=sources) elif not use_sources and use_level: results = NodeEvent.objects.filter( source_time__range=(start_date, end_date), level__exact=level) else: results = NodeEvent.objects.filter( source_time__range=(start_date, end_date) ]]] something like this: [[[ if use_sources: kwargs['sources']= request.GET.getlist('sources') if use_level: kwargs['level'] =request.GET['level'] ... results = NodeEvent.objects.filter(kwargs) ]]] I chanced passing a dictionary straight into objects.filter() as above, (given it has a **kwargs signature), but got this: 'dict' object has no attribute 'get_sql' when the QuerySet was evaluated. cheers Bill --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: offtopic: delete *.pyc from subversion
thanks. Am 29.11.2006 um 17:51 schrieb Marcin Jurczuk: > > find . -name '*pyc' |xargs svn delete > to delete them: > find . -name '*pyc"|xargs rm -f > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Suggestion: Aggregate/Grouping/Calculated methods in Django ORM
In another thread I wrote the following in regards to how to get the average for a field: > Could we educate ourselves on how other frameworks are solving this same > problem and maybe that will lead us to a solution? A quick look at ActiveRecord brings up ActiveRecord::Calculations: http://api.rubyonrails.org/classes/ActiveRecord/Calculations/ClassMethods.html I kind of like how the more common aggregate calculations are there: * count * max * min * sum * average Django already has: Entry.objects.count() Could Django also provide these? * Entry.objects.min('field') * Entry.objects.max('field') * Entry.objects.sum('field') * Entry.objects.average('field') And a way to group? * Entry.objects.max('age').group_by('last_name') And if you do group by it's probably a good idea to add HAVING somehow. I think for those who need aggregate data these would cover a lot of ground. I'd be willing to work on a patch if this is considered generally useful and we can work out what the API should look like. -Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
offtopic: delete *.pyc from subversion
in my svn-repository, I´m having *.pyc-files. question is: how do I get rid of these files? global-ignores is set to *.pyc now (after initial import and some changes). do I have to manually delete the pyc-files? since my svn-repos is django-related I dare to ask. thanks, patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Hard coded instances of model classes
Derek Hoy wrote: > For your application, you could have a simple Scale model, with a > field for the xml definition, to give you complete flexibility, then > build the forms using the scales, and just save a generic data-point > with the scale id and a value. Well, to tell you the truth, I did not quite get what your application is actually doing. But it sounds a bit too much for my application's needs. At first I had grand visions of doing fancy models for everything but then I figured that it just makes more sense to keep it simple and stupid. The occasional special cases (such as the special scales) I can just implement with some special "hacks". But thanks for the suggestion, I'll keep it in mind for the future. Mikko --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Opera & caching
> Yep, you want to use the Cache-Control HTTP directive [1]. More > specifically, you probably want to set `no_cache=True` to force > browsers to never cache that page. > > [1]: > http://www.djangoproject.com/documentation/cache/#controlling-cache-using-other-headers > Thank you for your tip, I try it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: offtopic: delete *.pyc from subversion
find . -name '*pyc' |xargs svn delete to delete them: find . -name '*pyc"|xargs rm -f --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py webserver
After much googling, I found that if there is no data in the tables, it produces a 404 error. I added some data, and sure enough, everything worked fine. So, that was my problem with that. :-( As for other problems, I agree, there is a lot of info that is displayed...but I guess I just don't know how to read it, which is my fault. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Help with admin views
I am hoping some of you can give me a little start as to where I can read how to alter some of the admin pages. I have a a Person class in my model and I want to change both the view of people plus I want to change the form page where people are added and deleted. Any links or examples or tutorials who greatly be appreciated. Thank, 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Initial data for models splitted across multiple files
Greetings, I did a quick search but found nothing about this issue. I have splitted my models across multiple files as described in http://code.djangoproject.com/wiki/CookBookSplitModelsToFiles. The manager action "sqlinitialdata" did not seem to find my sql files. After some investigation I found out that the manager application is searching for files with a path like /models/sql/.sql rather than /sql/.sql (as is the case when a single model file (models.py) is used). Is this a bug or is it just me? Mikko --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: best place to put dispatcher.connect code?
I don't think manage.py does much with the path, since the INSTALLED_APPS are given in Python package path syntax, and therefore must be resolvable on the PYTHONPATH (ie, no additional information is given for paths). The only thing I've noticed that it may twiddle is adding the directory containing settings.py to the path. So you may just need to do an import from myproject.myapp.foo.bar (ie, the full path, where it sometimes works to omit the myproject portion when specifying an installed app). Of course, if that doesn't work and the module you want to import is always in the same relative location to settings.py, you could always manipulate sys.path yourself. NRY On Wed, 2006-11-29 at 14:30 +, Le Roux Bodenstein wrote: > Aah. It is because of this chicken and egg scenario.. manage.py adds > your project's dir to the path after it imports your settings module. > So when the settings module is being imported your project is not in > the path yet, so you cannot import from > myproject.some_package.some_module.. > > I now added my dir to the path and it works fine. Feels dodgy, because > my app now has an extra dependency when you install it.. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Opera & caching
On 11/29/06, Michal <[EMAIL PROTECTED]> wrote: > > Hello, > I have problems with Opera browser and caching. > > I have URL /prihlaseni/. > If user isn't logged, I give him html form for login. > If user is already logged, I give him only text message, that inform him > about this state, together with link to logout. > > So, one URL, but two different content (depends on users login). > > Everything work just fine in my browser (Firefox). > I try the same in Opera browser, and there is problem. If user done > successfull login, then click on some other URL, and then go back to > /prihlaseni/ page, he see login form (but he should see only text). If I > make reload (CTRL+R), content is updated to correct content (text). > > I suppose, that this is occasioned by Opera and his caching, but maybe > this could be solved by some extra HTTP information send by Django (etag?). Yep, you want to use the Cache-Control HTTP directive [1]. More specifically, you probably want to set `no_cache=True` to force browsers to never cache that page. [1]: http://www.djangoproject.com/documentation/cache/#controlling-cache-using-other-headers > > I don't use Django framework. > > Do you have some advice? > > > Thank you > Regards > > Michal > > > > > -- Waylan Limberg [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: best place to put dispatcher.connect code?
I actually just tried that, but I'm getting import errors. Probably because I am importing from myapp.something.module.. Putting code in settings.py just seems dodgy. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: best place to put dispatcher.connect code?
Actually, no. That didn't really work. Now manage.py seems even more confused. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: best place to put dispatcher.connect code?
Aah. It is because of this chicken and egg scenario.. manage.py adds your project's dir to the path after it imports your settings module. So when the settings module is being imported your project is not in the path yet, so you cannot import from myproject.some_package.some_module.. I now added my dir to the path and it works fine. Feels dodgy, because my app now has an extra dependency when you install it.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: best place to put dispatcher.connect code?
Le Roux Bodenstein wrote: > Surely if I put it > in a model or a view or whatever somewhere it will only be called the > first time that module gets loaded? The settings module is always imported so you can import your handling code there and put dispatch.connect beside the handling code. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
best place to put dispatcher.connect code?
Hi I want to implement some custom caching stuff, so I want to capture _all_ post_save signals. Where is the best place to call dispatcher.connect? Surely if I put it in a model or a view or whatever somewhere it will only be called the first time that module gets loaded? Basically I'm asking if there is a place where I can put code that will always run when a django process executes and before any save() methods are called.. Le Roux --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Strange Proxy error
Turns out it WASN'T the state field... it was the fact that once the state was present, my geolocating script kicked in on page load and tried to get a geocode for the address. That makes a lot more sense. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Session data remains after logout
Thanks Antonio. This does not directly solve my problem (linked to an old PHP reflex by the way), but I'll definitely have a look as it may come in handy later. I see no 'magic' answer to my problem, and looking at the function django.contrib.auth.logout(), it's not that hard to wrap around it. Sunny day. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ManyRelatedManager object in templates
ie what is the simplest way to call the categories that have been selected for each organisation ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ManyRelatedManager object in templates
Ah ha! I've had a thought..could I use a custom Manager to predefine the query and then call in the template? In which case, how would a write a query set for the manager that only returns those categories that an organisation has selected? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Opera & caching
Opera's cache is very agressive. I use Opera for almost all of my internet browsing and I've never met a form that isn't shown again (with its field's content intact!) when "backing", either pressing the arrow or using mouse gestures, even when caching is completely disabled (in preferences, "always" check for images and documents). I like to think that's a feature... :p On 11/29/06, Michal <[EMAIL PROTECTED]> wrote: > > Hello, > I have problems with Opera browser and caching. > > I have URL /prihlaseni/. > If user isn't logged, I give him html form for login. > If user is already logged, I give him only text message, that inform him > about this state, together with link to logout. > > So, one URL, but two different content (depends on users login). > > Everything work just fine in my browser (Firefox). > I try the same in Opera browser, and there is problem. If user done > successfull login, then click on some other URL, and then go back to > /prihlaseni/ page, he see login form (but he should see only text). If I > make reload (CTRL+R), content is updated to correct content (text). > > I suppose, that this is occasioned by Opera and his caching, but maybe > this could be solved by some extra HTTP information send by Django (etag?). > > I don't use Django framework. > > Do you have some advice? > > > Thank you > Regards > > Michal > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Help with getting connection.queries info
I have a similar solution/problem... Firstly, my "solution" was to create a method in my vews.py like this... def my_render(request, template, dict): url_time = 0 try: for query in connection.queries: log( query['time'] + "\t" + query['sql']) t = float(query['time']) url_time = url_time + t log( str(t) + "\t" + query['sql'] ) except Exception, err: log(err) connection.queries = [] log("url_time: " + str( url_time) ) return render_to_response(template, dict) which is great, when I run my app in development mode... but as soon as I run it using FCGI/Lighttpd connection.queries is always empty... which is a pain because I want to watch sql queries on the server... I am using the Logging module... would using logging when there are 5 fcgi python processes cause a problem? Why does this work fine (or magnificently even) in dev mode and not in FCGI mode? Any ideas? Thanks tom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Templates and virtual hosts
On 29-Nov-06, at 3:44 PM, [EMAIL PROTECTED] wrote: > I have a template for my index page, I know the path is valid, but I > get a > Using loader django.template.loaders.filesystem.load_template_source give the full error message -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Templates and virtual hosts
I have a problem I can't talk in a huge ammount of details about. I have a template for my index page, I know the path is valid, but I get a Using loader django.template.loaders.filesystem.load_template_source (file does not exist). The permissions are giving group access to www and full access. I can cat the file and it output it. Is there any reason this would be causing me a problem. Incidentally I'm using latest svned django, python 2.4 modpython on an apache2 server installed on a mac os x 10.4.8 powerpc machine. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py webserver
very good info thank you. I knew i had seen it i just couldn't remember where. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: utf-8 with MySQL
I guess, this query may help you: ALTER DATABASE `yourdatabase` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci Regards, Aidas Bendoraitis [aka Archatas] On 11/29/06, Ryan Ginstrom <[EMAIL PROTECTED]> wrote: > > Thanks a lot for the tips. I was able to find a somewhat hackish solution. > > > From: django-users@googlegroups.com > > - If you're using a version of MySQL prior to 4.1, you should > > consider upgrading. 4.1 has a lot more support for unicode. > > Using 4.1.11 > > > - Are you *sure* that your entire database is in utf8? I > > thought mine was (it's a long story) but it turned out that > > many tables were still in latin1, with the Japanese text > > encoded in latin1. Check your database and all your > > individual tables to make sure. Do a mysqldump and look at > > the CHARSET settings for each table. > > This was it, it appears. The server encoding is utf-8, but the client is > latin-1. > > Changing the client setting to utf-8 seemed like a lot of hassle (i.e. I > don't know how to do it), so I solved the problem by hacking into django's > mysql backend code, and commenting out the "SET NAMES" command. > > # django/db/backends/mysql/base.py ~L104-105 > > # COMMENTED OUT BY RFG 12:16 2006/11/29 > # if self.connection.get_server_info() >= '4.1': > # cursor.execute("SET NAMES 'utf8'") > > Doing this, my data goes in and out untouched. A somewhat unsatisfying > solution, but it seems to work. > > Regards, > Ryan Ginstrom > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py webserver
Hi, > > I suspect you hit one small Django controversy. The generic view > > object_list would give you 404 error when the list it tries to show is > > empty. The view is there, it works, finds the list -- all is Ok. It just > > has this strange behavior by default. To overcome it you can add > > allow_empty: True to its infodict. > add "allow_empty: True" to the infodict of what? To your urls.py. As an example taken from your tutorial: from django.conf.urls.defaults import * from wilson.apps.portfolio.models import Project info_dict = { 'queryset': Project.objects.all(), } urlpatterns = patterns('', (r'^work/$', 'django.views.generic.list_detail.object_list', dict(info_dict, template_name="portfolio/projects_list.html", allow_empty=True)), (r'^work/(?P[-\w]+)/$', 'django.views.generic.date_based.object_detail', dict(info_dict, slug_field='slug')), ) > could this also be solved by actually adding data to the db before > trying to look at the page? As well. But you simply get round the problem, not solve it. Hope it helps, G --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Opera & caching
Hello, I have problems with Opera browser and caching. I have URL /prihlaseni/. If user isn't logged, I give him html form for login. If user is already logged, I give him only text message, that inform him about this state, together with link to logout. So, one URL, but two different content (depends on users login). Everything work just fine in my browser (Firefox). I try the same in Opera browser, and there is problem. If user done successfull login, then click on some other URL, and then go back to /prihlaseni/ page, he see login form (but he should see only text). If I make reload (CTRL+R), content is updated to correct content (text). I suppose, that this is occasioned by Opera and his caching, but maybe this could be solved by some extra HTTP information send by Django (etag?). I don't use Django framework. Do you have some advice? Thank you Regards Michal --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py webserver
Please allow a pure newbie to ask a couple questions . . . read in Ivan Sagalaev wrote: > [EMAIL PROTECTED] wrote: > > Now with django, I am trying to run through the "Are you generic" > > tutorial. When I go out to the URL, I get a 404 "Page not found" > > message, but absolutely no more information as to where to look! I > > thought by using the devel version with the verbosity flag, it would be > > able to show me something more, but nope! > > I suspect you hit one small Django controversy. The generic view > object_list would give you 404 error when the list it tries to show is > empty. The view is there, it works, finds the list -- all is Ok. It just > has this strange behavior by default. To overcome it you can add > allow_empty: True to its infodict. add "allow_empty: True" to the infodict of what? could this also be solved by actually adding data to the db before trying to look at the page? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---