Failures in auth.tests.views.ChangePasswordTest on trunk
Has anyone else seen this? Running tests with django.contrib.* installed on r9983. I just want to make sure I'm not doing something stupid here before I investigate a further. It's certainly possible because I see no tickets or relevant matches on the lists. http://dpaste.com/8094/ Creation of spatial database test_thingy successful. Creating table django_admin_log Creating table auth_permission Creating table auth_group Creating table auth_user Creating table auth_message Creating table django_comments Creating table django_comment_flags Creating table django_content_type Creating table django_flatpage Creating table django_redirect Creating table django_session Creating table django_site Installing index for admin.LogEntry model Installing index for auth.Permission model Installing index for auth.Message model Installing index for comments.Comment model Installing index for comments.CommentFlag model Installing index for flatpages.FlatPage model Installing index for redirects.Redirect model FFF. == FAIL: test_password_change_fails_with_invalid_old_password (django.contrib.auth.tests.views.ChangePasswordTest) -- Traceback (most recent call last): File "/a/thingy/src/current/python/django/contrib/auth/tests/ views.py", line 138, in test_password_change_fails_with_invalid_old_password self.assertEquals(response.status_code, 200) AssertionError: 403 != 200 == FAIL: test_password_change_fails_with_mismatched_passwords (django.contrib.auth.tests.views.ChangePasswordTest) -- Traceback (most recent call last): File "/a/thingy/src/current/python/django/contrib/auth/tests/ views.py", line 149, in test_password_change_fails_with_mismatched_passwords self.assertEquals(response.status_code, 200) AssertionError: 403 != 200 == FAIL: test_password_change_succeeds (django.contrib.auth.tests.views.ChangePasswordTest) -- Traceback (most recent call last): File "/a/thingy/src/current/python/django/contrib/auth/tests/ views.py", line 160, in test_password_change_succeeds self.assertEquals(response.status_code, 302) AssertionError: 403 != 302 -- Ran 36 tests in 1.062s FAILED (failures=3) Destroying test 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Take an integer and string and make one string
On Wed, Jul 16, 2008 at 10:14 AM, Molly <[EMAIL PROTECTED]> wrote: > I am trying to add an integer and a string: I assume self.slope_height_rr is the float? Have you tried turning it into a string before adding it to another string? def __unicode__(self): return self.consequence + ': ' + str(self.slope_height_rr) Brett --~--~-~--~~~---~--~~ 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: Inquiry
On Tue, Jul 15, 2008 at 8:40 AM, Marty Alchin <[EMAIL PROTECTED]> wrote: > Is it really > that bad a thing that users are in control of how they use your web > site? Exactly. Users can change the URL more easily than they can delete a cookie, so that one is effectively out (for his criteria). And as you noted, IPs change and don't really identify any one single user, and thus aren't a good way to handle sessions at all. Brett --~--~-~--~~~---~--~~ 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: Site wide date format
On Tue, Jul 15, 2008 at 8:14 AM, Adam Peacock <[EMAIL PROTECTED]> wrote: > Is this possible? Not with the current date filter. You could make your own templatetag that just wraps the existing one, though. http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags Brett --~--~-~--~~~---~--~~ 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: Inquiry
On Mon, Jul 14, 2008 at 7:48 PM, Kadusale, Myles <[EMAIL PROTECTED]> wrote: > I don't want to use cookies because they can be disabled by the user. Can you name a method of maintaining a session can't be altered or changed by the user? Brett --~--~-~--~~~---~--~~ 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: Caching: Memcached vs locmem
On Sat, May 17, 2008 at 8:12 PM, Brian <[EMAIL PROTECTED]> wrote: > But if you aren't clustering, say you have only a single server, is > there an advantage? Yes, locmem is memory local to a single Python process. If you're running Django in some sort of multi-process server (as most people do) e.g. Apache with the prefork MPM, each Python process will have to cache for itself. If you use memcached then all of your Python processes will speak to another process (memcached) and thus have the same cache state at any given time. > I turned on locmem today, but I don't think it is working. How can I > tell? I looked at my site with two browsers, one logged into admin, > and the other as anonymous. I made changes to the site as admin, and > the anonymous guy picked them up immediately. Is this using Django runserver, or under a 'production' setup such as Apache? If you're using Apache this could be an example of the above, your other user's request went to a different process which hadn't cached the page yet in its own local memory. Brett --~--~-~--~~~---~--~~ 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: What is the best search product?
On Sun, May 18, 2008 at 5:24 AM, Gene Campbell <[EMAIL PROTECTED]> wrote: > I am building a site that will require search. It will hold only > about 600,000 web pages, but it may get quite a few users. I am > looking at Solr and pylucene. > Can anyone offer up some experience with these products? Are there > any other ways to impl search like this with Python? Solr is supposed to be pretty great, you could check out (literally svn checkout) http://code.google.com/p/djangosearch/ Brett --~--~-~--~~~---~--~~ 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 query ManyToManyFields
On Thu, Feb 21, 2008 at 5:06 PM, Albert Hopkins <[EMAIL PROTECTED]> wrote: > I have a model with a M2M field and I want to filter based on the field > being empty. How do I do this? I tried > MyModel.objects.filter(m2mfield=[]) but that raises a (MySQL) exception. Is this what you want? MyModel.objects.filter(m2mfield__pk__isnull=True) Brett --~--~-~--~~~---~--~~ 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 use Decimal() objects
It just depends if you want to keep Decimal accuracy, floating point numbers lose some accuracy, it's up to you. Technically speaking floats are a little faster. > If the > later is true, where can I find the function that converts to the > Decimal type? It's in the standard library, from decimal import Decimal # Note that it takes a string a = Decimal('3.14') print a 3.14 b = 3.14 type(b) # Note that you cast it to a string first c = Decimal(str(b)) print c 3.14 a == c True --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Raw SQL to Django API Question and a ManyToMany Model Question
I've tried: people.get_list(lat__gte=minlat, lon__gte=minlon, lat__lte=maxlat, lon__lte=maxlon, tags__value__exact='django') TypeError: got unexpected keyword argument 'tags__value__exact' And: people.get_list(lat__gte=minlat, lon__gte=minlon, lat__lte=maxlat, lon__lte=maxlon, tag__value__exact='django') TypeError: got unexpected keyword argument 'tag__value__exact' --- class Tag(meta.Model): person = meta.ManyToManyField(Person, blank=True, null=True) tag = meta.CharField(maxlength=50, db_index=True) count = meta.IntegerField(blank=True, null=True) def _pre_save(self): self.tag = self.tag.lower() def __repr__(self): return self.tag class META: module_name = "tags" verbose_name_plural = "Tags" verbose_name = "Tag" admin = meta.Admin() --- Any ideas? Thanks much for the reply, though. Brett --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Raw SQL to Django API Question and a ManyToMany Model Question
Not sure if anyone will see this now that it's off the front page, but heres what I've gathered so far: I don't think the Django DB API can handle many2many stuff (at least right now) As for question 2, apparently you _can_ import a model in itself, so problem solved. Thanks to bitprophet on IRC. Brett --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Raw SQL to Django API Question and a ManyToMany Model Question
Working on a last-minute mapping app for PyCon here, I'm currently using a raw SQL query to SELECT information from People (Model) who all share the same Tag (Model in a ManyToMany with People). I'm feeding the query a range of lat/lon and the tag I want, c = db.cursor() c.execute("""select p.id, p.name, p.lat, p.lon from maps_people as p left join maps_tags_person as pt on pt.person_id = p.id left join maps_tags as t on t.id = pt.tag_id where t.tag = '%s' and p.lat >= %s and p.lon >= %s and p.lat <= %s and p.lon <= %s order by p.id""" % (request_tag, minlat, minlon, maxlat, maxlon)) r = c.fetchall() c.close() I'd just like to figure out the Django API equivalent (if there is one) to do something like this. I was thinking, like, people.get_list(lat__gte=minlat, lon__gte=minlon, lat__lte=maxlat, lon__lte=maxlon, has__tag=tag) or whatever... ideas? --- Second question, What is a good method of keeping a count of ManyToMany relationships that each entry in the table has? In the example above, I added a meta.IntegerField to the Tag Model, and I want it to hold the # of people that have that tag. I don't want to calculate this as-needed (way to often, if I use it)... I can't really import the model IN the model, can I? (I tried, and then my brain exploded) My original thought was to just add a _pre_save that updated with the count everytime a Tag was saved (Tags aren't really edited, so pretty much ALL saves affect the number of relationships) ... but I wasn't sure what a "best practice" method of this was. --- Thanks, Brett
Re: Which user posted the blog entry.
Remember that the Admin screen is under your control. You could just not display the User bit in the Admin, allow it to be posted as blank (blank=True), and the use _pre_save to grab the current User (session?) and set it.
Re: TimeField Problem/Question
> By "insert" I mean the initial creation of a tuple with that id in the > database, not subsequent updates of it. Yeah, sorry, I was thinking "insert" in English, not INSERT as in INSERT vs UPDATE, etc.
Re: Auto-reload is not working
Are you using a release version or a SVN checkout? I'd be using either (1) the latest SVN checkout, or (2) Release 0.90. The auto-refresh is a 'relatively new' change, so if you're working with an old release or checkout and just now trying it out - it won't be there.
Re: TimeField Problem/Question
Thanks, so... should this be changed in the Django-svn, or is this some special functionality I should really need/depend on? Also, I still think that users should be able to over-ride the values with auto_add[_now] on ... if they post data that should 'take', if the field is blank it should do the normal stuff, if that makes sense. Just a vote though, maybe I'm not seeing a reason for the way it is? Thanks much though, Daniel.
Re: TimeField Problem/Question
Ah, well... I've realized by messing around that "auto_now_add" assumes you aren't even going to display it. I was assuming that it would auto_add if you left it blank ... woops yet again. I think that would be nice though, or at least clear that up in the Docs, unless I missed something. :P
Re: TimeField Problem/Question
By the way, someone noted that I was using "time" and "date" - both reserved words. Woops. Well, I changed them to "time_posted", "date_posted", etc, and I still get the same error. KeyError at /admin/blog/posts/add/ "Could not find Formfield or InlineObjectCollection named 'time_posted'"
TimeField Problem/Question
(latest svn checkout) I can't seem to get a meta.TimeField to work properly (using the admin panel for now). DateField works fine, and DateTimeField works only if I let auto_now_add do the work (in other words, if auto_now_add is True and I don't set the Date/Time manually) Anyways, for now... TimeField. ** MODEL: ** class Post(meta.Model): date = meta.DateField(auto_now_add=True) time = meta.TimeField(auto_now_add=True) modified = meta.DateTimeField(auto_now=True) title = meta.CharField(maxlength=50) post_slug = meta.SlugField(blank=True) content = meta.TextField() category = meta.ForeignKey(Category, blank=True, null=True) status = meta.CharField(maxlength=2, choices=STATUS_CHOICES, radio_admin=True, default='DR') comment_status = meta.CharField(maxlength=2, choices=COMMENT_STATUS_CHOICES, radio_admin=True, default='OP') class META: unique_together = (("date", "post_slug"),) module_constants={'slugify': slugify} admin = meta.Admin( fields = ( ('General', {'fields': ('title', 'category', 'content',)}), ('Status Settings', {'fields': ('status', 'comment_status',)}), ('Date and Time', {'fields': ('date', 'time',)}), ), ) ** ERROR: ** KeyError at /admin/blog/posts/add/ "Could not find Formfield or InlineObjectCollection named 'time'" Request Method: GET Request URL:http://localhost:8000/admin/blog/posts/add/ Exception Type: KeyError Exception Value:"Could not find Formfield or InlineObjectCollection named 'time'" Exception Location: C:\Python24\lib\site-packages\django\core\formfields.py in __getitem__, line 119 I can post more as needed, but this is all I really have to work on now and I'm pretty confused. (egenix-mxDateTime 2.0.6, if that matters)