Re: RV: photos sexy
I was kinda in the mood for Raven ;) On Feb 26, 2010, at 12:10 PM, Gisela Cartaya wrote: My apologize for all, this has been a big mistake error, this is a technical mailing list I ask to the administrator to delete from archive that email as soon as possible. Thanks Greetings. De: Nicolas Couture [mailto:nicolas.cout...@gmail.com] Enviado el: Friday, February 26, 2010 1:16 AM Para: django-users@googlegroups.com CC: isaacr...@gmail.com Asunto: Re: RV: photos sexy This is probably the funniest post I've seen on a technical mailing list this year. __ Information from ESET NOD32 Antivirus, version of virus signature database 4220 (20090706) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/django-users?hl=en . -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: handle astronomically high number of users via the new BigIntegerField and contrib.auth.user
I assume you could checksum some form of the user's object or "cleaned" form values and store it as unique attribute of the users. You would prolly have to override the clean method and add in valudation of the uniqueness and generate using an alternate method if the first does not validate unique, the main issue I see is needing to get that value for the UUID unique every time. Could be as simple as salting the username with timestamp and checksumming the text. pad or trim to get the necessary length, but this doesnt seem necessary. Since your not using a base 10 character system anymore you can really increase the max number of users by alot without using a ton of space storing digits. One impact may be lookup time and index storage/maintenance as your uuid field would probably benefit from an index to reduce search time. With an "astronomically high number of users" I imagine your production equipment would need to be pretty serious already. On Jan 9, 2010, at 9:56 PM, G B Smith wrote: Eric, could you explain how this UUID implementation was achieved? Django doesn't have a built-in UUID, so I can only guess that you used a varchar field within Django. ? On Jan 10, 2:29 am, Eric Chamberlainwrote: On Jan 9, 2010, at 8:59 AM, G B Smith wrote: Thanks, that is a good resource. So this is what I am going to do : - -- modify the contrib.auth.models.user to explicitly include id = models.BigIntegerField(primary_key=True) -- modify the contrib.auth.models.user.id field in the database using creecode's method above or via the mysql shell or phpmyadmin or other tools (still deciding) I am pretty sure this is going to have zero side-effects. If someone knows otherwise, would be helpful to have that information. If your going to go to all that trouble, you may as well use a UUID field instead. We went with UUID, because we didn't want membership counts to leak via an autoincrementing integer. -- Eric Chamberlain, Founder RF.com -http://RF.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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/django-users?hl=en . -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: error using memcache and filter()
'yam, I have not seen this error, but my responses to the error are inline. On Jan 6, 2010, at 6:30 AM, Subramanyam wrote: File "/home/bvemu/lib/python2.6/site-packages/django/core/cache/ backends/memcached.py", line 37, in set self._cache.set(smart_str(key), value, timeout or self.default_timeout) So it appears your issue originates when you call cache.set (key,user_list) File "/home/bvemu/lib/python2.6/site-packages/python_memcached-1.45- py2.6.egg/memcache.py", line 515, in set return self._set("set", key, val, time, min_compress_len) File "/home/bvemu/lib/python2.6/site-packages/python_memcached-1.45- py2.6.egg/memcache.py", line 725, in _set store_info = self._val_to_store_info(val, min_compress_len) File "/home/bvemu/lib/python2.6/site-packages/python_memcached-1.45- py2.6.egg/memcache.py", line 697, in _val_to_store_info pickler.dump(val) PicklingError: Can't pickle : attribute lookup django.utils.functional.__proxy__ failed But from these last three lines you can deduce that "Can't pickle" is telling you the object is not unserializable (only in the failing case). So, when we reflect back on the point at which you populated the val you passed to the cache backend you will probably find: user_list=User.objects.all()[0:10] produces a list of objects that are serializable (ie, your superuser account) and user_list=User.objects.filter(is_staff=False)[0:10] is returning an unserializable value possibly? (although pickle.dump ([], some_object) succeeds, serializing an empty list) I would have to say it seems like you are passing unexpected data to the cacher that is not being validated as serializable and the pickler is failing to serialize the invalid data. But this is, just a guess... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Custom Authentication Backend
Or you could hack/port the library Peter spoke of earlier and add the functionality you are looking for :] but how would you admin it, and i bet alot would break at first sight. On Dec 3, 2009, at 4:33 PM, Peter Herndon wrote: > > On Dec 3, 2009, at 3:29 PM, bfrederi wrote: > >> I'm not looking to avoid effort. I just don't want a bunch of extra >> users cluttering up my system if I don't need to. I have no desire >> for >> them to exist in my system for any reason. I want to keep the number >> of django users limited in my system so it is easier to manage them >> in >> admin. >> >> Thanks for the import advice though. Unfortunately, it's not what I'm >> seeking. >> > > In which case, you'll need to rewrite an awful lot of contrib.auth > to work with LDAP directly. The existing contrib.auth is designed > to work with User models stored in a relational database, > manipulated via the standard Django ORM. There are any number of > working snippets for importing user data from LDAP or other sources > on successful authentication, but they all work by creating a User > and storing the model in the db. They just get their user info from > AD, or wherever. The one you chose is very workable. > > While it sounds like a grand thing to avoid the redundancy of > storing your users both in the db and in your original source, the > amount of work involved makes it a non-starter for all but the most > obsessed. And it really doesn't buy you much, practically > speaking. I'd suggest to you that a better approach would be to > work on customizing the admin to separate out your LDAP users from > your local-to-Django users, I seem to recall seeing some snippets to > that purpose. Basically, just rope off your LDAP users and ignore > them. > > Though if you *do* wind up rewriting contrib.auth to work directly > from LDAP, please do post, I'd love to see it. > > ---Peter > > P.S.: Thanks for the plug, Mike! :) > > -- > > You received this message because you are subscribed to the Google > Groups "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en > . > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Timer in Django
Why use a timer, what about storing time in a "taken_time" column in your model, then subtract expiration time from current and check if this number is grater than the "Taken time" timestamp In the view the gets ready to render a browsable object, just do the same time difference hickamajig as above and determine if the item is available before rendering it to the template? I think you can also do the math in the template... my preference is to keep as much logic as possible out of the presentation layer. On Dec 3, 2009, at 3:24 PM, Mark wrote: > Hi, > > I'm using Django to create registration/payment application for a > limited number of products.I want to create a timer so that when a > user chooses to purchase a product, that product will then displayed > as "already taken". But, if the user the user does not go through > with the purchase and the timer runs out, the product goes back to > status "available". If the user completes the purchase, the timer > should cancel, leaving the product's status permanently as "already > taken". > > I've tried using python's dictionary to instantiate python Timer > objects of the fly, but about 30% of the time, I get a "key error" > when it's time to cancel the Timer. > > Please. Could someone give me an idea on the proper way to do this in > Django? > > Thanks very much! > Mark > > -- > > You received this message because you are subscribed to the Google > Groups "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en > . > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Returning Django objects from Ajax request
I'm not so sure that a django question as much as it is a Python question... http://docs.python.org/library/json.html On Dec 2, 2009, at 2:01 PM, jul wrote: > I'm using jQuery post: > > $.post("/getRestaurant/", location, > function(data) { > /* stuff */ > }); > > In my view, how do I convert my Restaurant array to json? > > Thanks for your reply! > > > On Dec 2, 7:52 pm, Javier Guerrawrote: >> On Wed, Dec 2, 2009 at 1:36 PM, jul wrote: >>> How can I return these objects to the javascript in my template? >> >> if you're using jQuery's elm.load(url) function, you have to return >> an >> HTML fragment to replace the one already in the browser; so use a >> template that renders just this fragment. >> >> if you use a JavaScript template (there are several jQuery plugins), >> just return the data in JSON. >> >> -- >> Javier > > -- > > You received this message because you are subscribed to the Google > Groups "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en > . > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Browsing Django modules from interactive python shell
Hello Kenny, As Bill mentioned in this threads parallel thread, you are prolly just entring the python shell like thiis $ python Instead try this from you projects directory (django_site\mysite) $ python manage.py shell As bill mentioned all kindsa magical cool stuff happens... fdiro...@4b0x [~/Code/django-b-cool/mysite $] python manage.py shell Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> dir(django.core) Traceback (most recent call last): File "", line 1, in NameError: name 'django' is not defined >>> import django >>> dir(django.core) ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'cache', 'exceptions', 'files', 'management', 'signals', 'urlresolvers'] Thnx Bill for that info :] On Dec 2, 2009, at 11:37 AM, Kenny Meyer wrote: > On Wed, 2 Dec 2009 11:19:41 -0500 > Frank DiRocco <ofang...@gmail.com> wrote: > >> How about trying to look at whats available for django... mine says >> this >> >>>>> import django >>>>> dir(django) >> ['VERSION', '__builtins__', '__doc__', '__file__', '__name__', >> '__package__', '__path__', 'conf', 'contrib', 'core', 'db', >> 'dispatch', 'forms', 'get_version', 'http', 'middleware', >> 'shortcuts', 'template', 'utils', 'views'] >>>>> dir(django.core) >> ['__builtins__', '__doc__', '__file__', '__name__', '__package__', >> '__path__', 'cache', 'exceptions', 'files', 'management', 'signals', >> 'urlresolvers'] >> >> >> On Dec 2, 2009, at 11:14 AM, Kenny Meyer wrote: >> >>> Hi guys, >>> >>> I have some strange behaviour in my interactive python shell, when >>> trying to browse Django modules... >>> >>> Example: >>> >>>>>> import django >>>>>> dir(django.core) >>> AttributeError: 'module' object has no attribute 'core' >>> >>>>>> import django.core >>>>>> dir(django.core) >>> ['__builtins__', '__doc__', '__file__', '__name__', '__package__', >>> '__path__'] >>> >>> Can anyone, please, explain me this strange (to me) behaviour? >>> >>> Regards, >>> Kenny >>> >>> >>> .' `.knny [d0t] myer [at] gmail [d0t] com [42!] >>> |a_a | http://kenny.paraguayinfos.de | gpg key ID: 0x00F56BA1B2 >>> \<_)__/ >>> /( )\ Everything should be made as simple as possible, but not >>> |\`> < /\simpler. >>> \_|=='|_/-- Albert Einstein >> >> -- >> >> You received this message because you are subscribed to the Google >> Groups "Django users" group. To post to this group, send email to >> django-us...@googlegroups.com. To unsubscribe from this group, send >> email to django-users+unsubscr...@googlegroups.com. For more options, >> visit this group at http://groups.google.com/group/django-users? >> hl=en. >> >> > > Hi Frank, > > Well that's strange... I don't get similar output, but see it > yourself: > >>>> import django >>>> dir(django) > ['VERSION', '__builtins__', '__doc__', '__file__', '__name__', > '__package__', '__path__', 'get_version'] > > I'm running Ubuntu 9.10 and installed django with `aptitude` named > `python-django`. > > Regards, > Kenny -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Browsing Django modules from interactive python shell
How about trying to look at whats available for django... mine says this >>> import django >>> dir(django) ['VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'conf', 'contrib', 'core', 'db', 'dispatch', 'forms', 'get_version', 'http', 'middleware', 'shortcuts', 'template', 'utils', 'views'] >>> dir(django.core) ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'cache', 'exceptions', 'files', 'management', 'signals', 'urlresolvers'] On Dec 2, 2009, at 11:14 AM, Kenny Meyer wrote: > Hi guys, > > I have some strange behaviour in my interactive python shell, when > trying to browse Django modules... > > Example: > import django dir(django.core) > AttributeError: 'module' object has no attribute 'core' > import django.core dir(django.core) > ['__builtins__', '__doc__', '__file__', '__name__', '__package__', > '__path__'] > > Can anyone, please, explain me this strange (to me) behaviour? > > Regards, > Kenny > > > .' `.knny [d0t] myer [at] gmail [d0t] com [42!] > |a_a | http://kenny.paraguayinfos.de | gpg key ID: 0x00F56BA1B2 > \<_)__/ > /( )\ Everything should be made as simple as possible, but not > |\`> < /\simpler. > \_|=='|_/-- Albert Einstein -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: missing template for login page
I'm very interested in this as well. I wrote almost all the forms and logic to do what this module already does :/ I should lrn2RTFM! but that's been an uphill battle for many ppl ;) On Dec 2, 2009, at 8:48 AM, Andreas Kuntzagk wrote: > Hi, > > I try to get user authentication working. I followed the advice on > http://docs.djangoproject.com/en/dev//topics/auth/#django.contrib.auth.decorators.login_required > to use the login_required decorator. I also get forwarded to > http://bbc:8000/accounts/login/?next=/blabla > url.py for this reads: > (r'^accounts/login/$', 'django.contrib.auth.views.login'), > > but then it complains about a missing template registration/login.html > > I tried copying /django/contrib/auth/tests/templates/ to > /django/contrib/auth/ but this gives me a form with only two fields > and > no submit button so it's probably the wrong template. Where do I find > the right one or do I have to write it on my own. > > regards, Andreas > > -- > > You received this message because you are subscribed to the Google > Groups "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en > . > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Inlineformset_factory and User model
request.user will give you the User object from the django.contrib.auth.models, but Authors has no relation. If you slightly modify your Book model to make authors relate to the above module, you can eliminate the Authors Model and the "user" of you Book model. class Book(models.Model): ... authors = models.ManyToManyField(User, related_name='Entries') ... Now in you view, all you have to do is: def add_books(request): if not request.user.is_authenticated(): return HttpResponseRedirect("accounts/login") if request.method == "POST": formset = BookFormSet(request.POST) if formset.is_valid(): formset.save() return HttpResponseRedirect('books/latest.html') I'm a n3wb so, I'm fishing to see if I'm understanding the same :] -Frank On Dec 2, 2009, at 8:06 AM, saved...@gmail.com wrote: > Hello All! > I am trying to have my users post multiple books via > Inlineformset_factory. Basically, I am unable to do that > automatically via the following code without having them select their > name. I get an error saying that 'User has no attribute 'get''. Any > help is much appreciated. Ken > > models.py > = > class Author(models.Model): >name = models.CharField(max_length=100) >user = models.ForeignKey(User) > > class Book(models.Model): >author = models.ForeignKey(Author) >title = models.CharField(max_length=100) >user = models.ForeignKey(User) > > forms.py > > class AuthorForm(forms.ModelForm): >def __init__(self, user=None, *args, **kwargs): >self.user = user >super(AuthorForm, self).__init__(*args, **kwargs) > >class Meta: >model = Author > > BookFormSet = inlineformset_factory(Author, Book, extra=4, max_num=4, > can_delete=False, exclude ='user') > > > views.py > = > def add_books(request, author_id): >author = Author.objects.get(pk=author_id) >if request.method == "POST": >formset = BookFormSet(request.user, request.POST, > request.FILES, instance=author) >if formset.is_valid(): >books = formset.save(commit=False) >books.user = request.user >books.save() >else: >formset = BookFormSet(instance=author) >return render_to_response("manage_books.html", { >"formset": formset, >}) > > -- > > You received this message because you are subscribed to the Google > Groups "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en > . > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Help with installing MySQLdb package for Django on OS X Snow Leopard
James, With Snow Leo and preinstalled MySQL5 the package I'm using is here. http://sourceforge.net/projects/mysql-python/files/ MySQL-python-1.2.3c1.tar.gz Direct Link: http://sourceforge.net/projects/mysql-python/files/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz/download IMHO, source forge is a little wack these days. The UI is kinda convoluted, it took me a little digging before I found the file too :] -Frank On Dec 2, 2009, at 7:18 AM, James Dekker wrote: > Daniel, > > Under the Files tab, the only ones that are available are for Linux > not OS X Snow Leopard... > > -James > > On Wed, Dec 2, 2009 at 1:37 AM, Daniel Roseman >wrote: >> On Dec 1, 11:23 pm, James Dekker wrote: >> >>> My problem, however, is that I can't seem to figure out how to >>> install the MySQLdb package for Python / Django? >>> >>> Downloaded the tar.gz from: >>> >>> http://sourceforge.net/projects/mysql-python/ >> >> The main 'Download Now' link from this page for some reason links to >> the Zope adaptor. However you can click on 'View all files' to see >> the >> actual packages for MySQLdb. >> >> Of course if you're still having problems there's no requirement to >> use MySQL in Django, you can just use sqlite3 which should work >> without any additional requirements. >> -- >> DR. >> >> -- >> >> You received this message because you are subscribed to the Google >> Groups "Django users" group. >> To post to this group, send email to django-us...@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com >> . >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en >> . >> >> >> > > -- > > You received this message because you are subscribed to the Google > Groups "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en > . > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.