Re: Developer help appreciated: unicode() not returning SafeString correctly - possibly a bug?
On Wed, Oct 14, 2009 at 6:25 PM, Margie Roginski wrote: > > Eventually I end up in the force_unicode() function at code that looks > like this: > > if hasattr(s, '__unicode__'): >s = unicode(s) > > The call to unicode(s) has resulted in my render function getting > called, and as far as I can tell, unicode(s) should simply return the > value that my render function returned. I would expect the resulting > 's' to be a SafeString. However, if I look at the type of s after > unicode(s) has been called, it's type is now rather > than > > Python absolutely positively no exceptions requires that unicode(x) returns unicode. If your implementation of __unicode__ does not return unicode, then Python will attempt to coerce it to unicode. SafeString inherits from str, and str is a type that can be coerced to unicode, so that is what Python does. (If an implementation of __unicode__ returns something that is neither unicode nor can be coerced to unicode, an exception will be raised.) > This seems to result in the mark_safe() that I did in my render > function not having the intended effect. > > I have anlayzed this code to death, and I absolutely cannot figure out > why the value being returned by my render function would be changing > from SafeString to unicode. > > Because Python forces the return value from a unicode() call to be of type unicode, so it coerces the SafeString to unicode. Note that if in my render() function I have a unicode string rather > than a normal string, I don't see this issue. I can obviously work > around this, but would like to know if this seems like a bug that I > should post. Perhaps it is a python bug even? That's hard to > believe, but I guess it's possible. > > If you call mark_safe on a unicode type, you get SafeUnicode instead of SafeString. Since SafeUnicode inherits from unicode, no conversion is needed and the safeness property is maintained through the calls. Why do you want to be returning strings instead of unicode from your widget's render()? Karen --~--~-~--~~~---~--~~ 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: displaying tree data in admin
There is no sucj feature in admin interface On Wed, Oct 14, 2009 at 9:18 PM, ev wrote: > > I've created model Structure referenced to itself and filled it with > my data. > > class Structure(models.Model): >parent=models.ForeignKey('self', blank=True, null=True, > related_name='child_set') >title=models.CharField(max_length=100) > > Default admin interface shows my data as a plain list. What should I > do to see my data in a tree? > > > > -- regards, Mihail --~--~-~--~~~---~--~~ 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: Admin Settings
or create a function that return object.foreign_key.field1. then use the function in list_display cheers. -djibon- On 10/14/09, justquick wrote: > > try using 'foreign_key__field1' instead > > On Oct 14, 12:04 pm, freeav8r wrote: >> Is it possible to do something like this: >> >> class MyModelAdmin(admin.ModelAdmin): >> list_display = (‘field1’, field2’, ‘foreign_key’, >> ‘foreign_key.field1’, foreign_key.field2’,) >> >> admin.site.register(MyModel, MyModelAdmin) >> >> ‘foreign_key’ works just fine, but ‘foreign_key.field1’ and >> ‘foreign_key.field2’ error out. Any suggestions? > > > -- -- http://www.tumbletooth.org my linkedin profile : http://www.linkedin.com/in/bayuadji -- --~--~-~--~~~---~--~~ 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: First tutorial - Not off to a good start :(
Glad you found a solution. I think though that you could have also just removed the .py, not add 'python', so your command would have been, $ django-admin startproject mysite cheers On Oct 4, 2:08 pm, Leke wrote: > > The script seems to be missing the x bits for execution. > > Try > > $ python /usr/lib/python-django/bin/django-admin.py startproject mysite > > You were right. I forgot all about needing to call python. Thanks to > you both for your 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Developer Position in New York City, Urgent Stuff
LOL @ everyone getting trolled by four letters On Oct 11, 8:05 pm, Wayne Koorts wrote: > >> Please refrain from posting messages with this tone to the Django mailing > >> lists. > > > I wholeheartedly agree. > > The Django community has a good reputation. > > Don't screw it up with your foul verbal attacks. > > Surely it should be grounds for instant removal? > > Regards, > Wayne --~--~-~--~~~---~--~~ 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: Just upgraded to 1.1, can't start development server, TypeError
Not so sure about that. Here are my installed apps: INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'myproject.api', 'myproject.pages', 'myproject.contact_form', 'myproject.albums', 'myproject.paypalcart', 'myproject.messaging', ) None of them are being pulled from my python path? Am I missing something obvious? On Oct 14, 1:09 am, Lakshman Prasad wrote: > Seems like, some of the apps that you have in settings.py INSTALLED_APPS are > there in the pythonpath for python2.5 and not for python2.6. > You will need to do a easy_install-2.6 (or a corresponding pip/distribute > equivalent) package_name > > > > > > On Wed, Oct 14, 2009 at 11:48 AM, eculver wrote: > > > I just tried upgrade to django 1.1, ran ./manage.py runserver, but was > > promptly halted due to this exception: > > > ... > > > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ > > site-packages/django/utils/translation/trans_real.py", line 180, in > > _fetch > > app = import_module(appname) > > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ > > python2.6/site-packages/django/utils/importlib.py", line 35, in > > import_module > > __import__(name) > > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ > > python2.6/site-packages/django/contrib/admin/__init__.py", line 1, in > > > > from django.contrib.admin.options import ModelAdmin, HORIZONTAL, > > VERTICAL > > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ > > python2.6/site-packages/django/contrib/admin/options.py", line 5, in > > > > from django.contrib.contenttypes.models import ContentType > > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ > > python2.6/site-packages/django/contrib/contenttypes/models.py", line > > 1, in > > from django.db import models > > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ > > python2.6/site-packages/django/db/__init__.py", line 57, in > > 'TIME_ZONE': settings.TIME_ZONE, > > TypeError: __init__() takes exactly 1 argument (2 given) > > > Everything worked fine in 1.0.4 before the upgrade. Seems like it may > > be an obvious upgrade problem/oversight on my part. Any ideas? > > -- > Regards, > Lakshman > becomingguru.com > lakshmanprasad.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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Upload Progress Bar
Sorry to drag up a really old topic, but I am having the same issue as Pawel on the thread at http://groups.google.com/group/django-users/browse_thread/thread/738ef445d524fdb0. I've responded to that thread, but my message didn't seem to come up. So, I apologise if this ends up here twice. Is Pawel still around? Was anyone able to help solve this problem? If not, could anyone help? The basic question is that he was (as am I) trying to implement a version of the upload progress bar from http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress-bars-jquery-django-nginx/. All seems to be working ok (no errors from Django, and the empty progress bar displays for a while during upload), except that the bar doesn't move, and Javascript keeps returning "upload is null". I'm also getting the same value "null" being returned from the upload_progress view in Django (which in turn is what the JS is receiving at each interval it checks the view), although i'm using a slightly different setup than Pawel (mod_wsgi instead of mod_python, and jQuery instead of YUI). Any help would be massively and hugely appreciated. -Matt --~--~-~--~~~---~--~~ 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: settings.configure vs DJANGO_SETTINGS_MODULE
On Tue, Oct 13, 2009 at 10:06 PM, Doug Blank wrote: > I'm trying to use django without resorting to setting the environment > variable, by doing this: > > from django.conf import settings > import mysettings > settings.configure(mysettings, DEBUG=True) > > The mysettings.py originally just contained those in the default > settings.py file. > > However, I keep getting errors claiming that my module is missing > settings, such as this error: > > ... > File > "/usr/lib/python2.6/site-packages/django/utils/translation/trans_real.py", > line 194, in translation > default_translation = _fetch(settings.LANGUAGE_CODE) > File > "/usr/lib/python2.6/site-packages/django/utils/translation/trans_real.py", > line 172, in _fetch > for localepath in settings.LOCALE_PATHS: > File "/usr/lib/python2.6/site-packages/django/utils/functional.py", > line 273, in __getattr__ > return getattr(self._wrapped, name) > File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", > line 130, in __getattr__ > return getattr(self.default_settings, name) > AttributeError: 'module' object has no attribute 'LOCALE_PATHS' > > I've added a bunch of settings with their defaults after I get such an > error, such as these: > > DATABASE_OPTIONS = '' > URL_VALIDATOR_USER_AGENT = '' > DEFAULT_INDEX_TABLESPACE = '' > DEFAULT_TABLESPACE = '' > CACHE_BACKEND = 'locmem://' > TRANSACTIONS_MANAGED = False > > and it will run further into some new code, until django looks up > another setting, and it isn't there. > > Everything works fine if I set the DJANGO_SETTINGS_MODULE env variable. > > I've read: > > http://docs.djangoproject.com/en/dev/ref/settings/ > > and the older version for 1.0, but they both suggest that what I'm > doing is correct. > > I'm using sqlite and Django-1.1-4.fc11.noarch under Fedora 11. > > Is this a bug, or am I doing something wrong? > > Thanks for any insight! > > -Doug > I was able to make it through all of the tests with my sqlite backend by adding all of these default values: DATABASE_OPTIONS = '' URL_VALIDATOR_USER_AGENT = '' DEFAULT_INDEX_TABLESPACE = '' DEFAULT_TABLESPACE = '' CACHE_BACKEND = 'locmem://' TRANSACTIONS_MANAGED = False LOCALE_PATHS = tuple() But I'm wondering if I change the backend if there will be other missing values. Do people not use settings.configure()? I would think that most people would not want to have to rely on an environment variable. -Doug --~--~-~--~~~---~--~~ 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: Middleware stored locally
I think every dir on the import path needs and __init__.py On Oct 14, 5:10 pm, When ideas fail wrote: > If i have a lib folder in my app what is the correct way to reference > it in settings.py? > > I've tried this > > MIDDLEWARE_CLASSES = ( > 'myapp.lib.django_authopenid.middleware.OpenIDMiddleware' > # and > 'myapp.django_authopenid.middleware.OpenIDMiddleware' > ) > > the file its in is > > \Apache2.2\myapp\lib\django_authopenid > > but I get a 500 Internal Server and the error log tells me the > following: > > [Thu Oct 15 00:56:39 2009] [error] [client 127.0.0.1] raise > exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"' > % (mw_module, e) > [Thu Oct 15 00:56:39 2009] [error] [client 127.0.0.1] > ImproperlyConfigured: Error importing middleware > abeona.django_authopenid.middleware: "No module named > django_authopenid.middleware" > > I'd appreciate any help > > Thanks > > Andrew --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Middleware stored locally
If i have a lib folder in my app what is the correct way to reference it in settings.py? I've tried this MIDDLEWARE_CLASSES = ( 'myapp.lib.django_authopenid.middleware.OpenIDMiddleware' # and 'myapp.django_authopenid.middleware.OpenIDMiddleware' ) the file its in is \Apache2.2\myapp\lib\django_authopenid but I get a 500 Internal Server and the error log tells me the following: [Thu Oct 15 00:56:39 2009] [error] [client 127.0.0.1] raise exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"' % (mw_module, e) [Thu Oct 15 00:56:39 2009] [error] [client 127.0.0.1] ImproperlyConfigured: Error importing middleware abeona.django_authopenid.middleware: "No module named django_authopenid.middleware" I'd appreciate any help Thanks Andrew --~--~-~--~~~---~--~~ 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: Multi-db support
On Thu, Oct 15, 2009 at 3:08 AM, Jeff Bell wrote: > > Hi all, > > Am I wasting my time trying to figure out multi-db functionality. I > know that Alex Gaynor is working on a GSOC project that is slatted for > Django 1.2 release that deals with this, but I can't imagine that > being released anytime soon. Don't be so sure. The gsoc2009 multi-db branch that Alex was working on over the summer is usable, as long as you don't mind a couple of sharp edges. There's only a small handful of issues left, and most of those are really about the internals. What is in the branch is reasonably well documented - the two changes to look for are the new DATABASES setting, and the using() method on querysets. There is still some work to be done to make the public interface a little easier to use for some common use cases; the more feedback we get on these aspects, the better. So - if you're feeling adventurous (and if you're willing to try out multidb on your own, I'm guessing you are), it's worth taking a look at Alex's branch. 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: When would you use Context instead of RequestContext?
On Thu, Oct 15, 2009 at 12:39 AM, ringemup wrote: > > Is there ever a reason to pass a plain Context rather than a > RequestContext when rendering a template? Sure. Any time you don't have a request. There are any number of reasons you might not have a request. One obvious example is in a standalone script (e.g., a cron script) that is sending an email whose content is templated. 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to start this dev server
Thanks Gregor for your reply. Fixed. Server is running now. d...@sgbr:~/nimoy$ ls -l total 32 -rw-r--r-- 1 dwang dwang0 2009-10-14 14:52 __init__.py -rw-r--r-- 1 dwang dwang 135 2009-10-14 14:53 __init__.pyc -rwxr-xr-x 1 dwang dwang 542 2009-10-14 14:52 manage.py drwxr-xr-x 8 dwang dwang 4096 2009-10-14 14:52 media -rw-r--r-- 1 dwang dwang 235 2009-10-14 14:52 nimoy.wsgi drwxr-xr-x 4 dwang dwang 4096 2009-10-14 15:19 reporting -rw-r--r-- 1 dwang dwang 2950 2009-10-14 14:52 settings.py -rw-r--r-- 1 dwang dwang 1914 2009-10-14 14:53 settings.pyc -rw-r--r-- 1 dwang dwang 931 2009-10-14 14:52 urls.py d...@sgbr:~/nimoy$ On Oct 14, 4:07 pm, Gregor Müllegger wrote: > Hi, > > please try to create an empty __init__.py file in your ~/nimma/ > directory. > > Gregor > > On 15 Okt., 00:50, David wrote: > > > > > Hello django community, > > > I checked out a django project from svn and tried to start dev server, > > however I met > > > d...@sgbr:~/nimma$ python manage.py runserver > > Error: No module named nimma > > d...@sgbr:~/nimma$ > > > In my home directory I have > > > nimma -> svn/nimma/trunk/ > > svn > > > and "svn" is a work copy and leads to "svn/nimma/trunk". In "trunk" > > there are "manage.py", "settings.py", "urls.py", etc. > > > Anybody knows how to make dev server start in this case? > > > Thanks so much.- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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: How to start this dev server
Hi, please try to create an empty __init__.py file in your ~/nimma/ directory. Gregor On 15 Okt., 00:50, David wrote: > Hello django community, > > I checked out a django project from svn and tried to start dev server, > however I met > > d...@sgbr:~/nimma$ python manage.py runserver > Error: No module named nimma > d...@sgbr:~/nimma$ > > In my home directory I have > > nimma -> svn/nimma/trunk/ > svn > > and "svn" is a work copy and leads to "svn/nimma/trunk". In "trunk" > there are "manage.py", "settings.py", "urls.py", etc. > > Anybody knows how to make dev server start in this case? > > Thanks so much. --~--~-~--~~~---~--~~ 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: Can't get css working
Nope, that's a much better solution, since you don't repeat yourself nearly as much. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How to start this dev server
Hello django community, I checked out a django project from svn and tried to start dev server, however I met d...@sgbr:~/nimma$ python manage.py runserver Error: No module named nimma d...@sgbr:~/nimma$ In my home directory I have nimma -> svn/nimma/trunk/ svn and "svn" is a work copy and leads to "svn/nimma/trunk". In "trunk" there are "manage.py", "settings.py", "urls.py", etc. Anybody knows how to make dev server start in this case? Thanks so much. --~--~-~--~~~---~--~~ 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: djangocon videos
> anybody knows when djangocon september/portland videos will be > available? I expect you'll hear about their availability here first: http://twitter.com/djangocon --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ModelChoiceField Work around or danger
I was struggling to find a solution to the ModelChoiceField looking up 100,000 students every time I wanted to add an RtI so I did the following. Can anyone find problems with this, or have an alternate solution...This does work though Instead of using an id I used a student_number as an IntegerField (on the form and it's hidden) and then checked if that integer was a key in the request.POST return and then did a get_object_or_404. Indentations are probably wrong on this email, so you may have to correct them. I made the foreign keys null=True and blank=True to avoid any conflicts there. I know I have to probably clean the data too. def create_student_rti_background(request, student_id): if request.method == "POST": form = StudentRtiBackgroundForm(request.POST) if form.is_valid(): student_rti_background = form.save(commit=False) if request.POST.has_key('school_district_number'): school_district_number = request.POST['school_district_number'] student_rti_background.school_district = get_object_or_404(SchoolDistrict, pk=int(school_district_number)) if request.POST.has_key('student_number'): student_number = request.POST['student_number'] student_rti_background.student = get_object_or_404(Student, pk=int(student_number)) student_rti_background.save() url='/ess/student/StudentRtiBackground/%s' % str(student.id) return HttpResponseRedirect(url) else: url='/ess/student/StudentRtiBackground/New/%s' % student.id return HttpResponseRedirect(url) else: profile = get_object_or_404(UserProfile, user=request.user) school_district = profile.school_district student = get_object_or_404(Student, pk=student_id) form = StudentRtiBackgroundForm(initial={'student_number':int(student.id), 'school_district_number':int(school_district.id)}) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Developer help appreciated: unicode() not returning SafeString correctly - possibly a bug?
I am seeing some odd behavior related to the django.utils.safestring.SafeString class. What I see is that if my render function returns a SafeString, the "safeness" of it is lost and its tags end up getting escaped. I've looked at this in detail in pdb and I think the issue is in force_unicode(), but I don't have the full answer, am hoping a developer that knows this code can give me some ideas. I have a widget whose render() method returns a SafeString, ie: def render(self, name, value, attrs=None): mystr = "some string"# note it's a string, not unicode - this is important return mark_safe(mystr) # returns a SafeString If at this point in the code, I start stepping through the code, I find that this SafeString value gets returned without any modification by my render() function, then by as_widget(), and then by __unicode__ (). At those points in the code, if I munge the code a bit to create a temporary variable and then look a the type of that temporary variable, the value being returned is still a , as you'd expect. Eventually I end up in the force_unicode() function at code that looks like this: if hasattr(s, '__unicode__'): s = unicode(s) The call to unicode(s) has resulted in my render function getting called, and as far as I can tell, unicode(s) should simply return the value that my render function returned. I would expect the resulting 's' to be a SafeString. However, if I look at the type of s after unicode(s) has been called, it's type is now rather than This seems to result in the mark_safe() that I did in my render function not having the intended effect. I have anlayzed this code to death, and I absolutely cannot figure out why the value being returned by my render function would be changing from SafeString to unicode. Note that if in my render() function I have a unicode string rather than a normal string, I don't see this issue. I can obviously work around this, but would like to know if this seems like a bug that I should post. Perhaps it is a python bug even? That's hard to believe, but I guess it's possible. Margie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: hosting from /some/url in apache
On Oct 15, 7:46 am, Daniel Hilton wrote: > 2009/10/14 Jani Tiainen : > > Chris Withers kirjoitti: > >> Hi All, > > >> I need to host my django project from /some/folder in my apache instance. > > >> I have the following: > > >> WSGIScriptAlias /some/folder /path/to/django.wsgi > > >> Does this now mean I have to prefix all my entries in urls.py with > >> /some/folder? > > >> I hope not, but give that going to: > > >>http://myserver/some/folder > > >> ...gives me a 404 unless I do, I'm not hopeful. > > >> What am I doing wrong? > > > "nothing". > > > Term is called "suburl deployment" and I've done it (for testing purposes). > > > Apache config: > > > RewriteEngine On > > > #add missing trailing slash if needed > > RewriteRule ^/$ // [R] > > > #WSGI alias[[BR]] > > WSGIScriptAlias / absolute_path_to_wsgi_file.wsgi[[BR]] > > > And if you're using authentication in your app you must provided full > > absolutely URL to login page, I've done it settings.py: > > > LOGIN_URL='//login/' > > > And that's it. Of course you have to keep all your apps using hardcoded > > urls but use reverse url finding always. > > Does this enable you to run a django project only on a certain url? > > So, say for example you've got a legacy php site that has the > siteroot, could you run a django app off of // ? Yes. Except that Django will see itself being mounted at the sub URL. Since urls.py will not mention the sub URL, that isn't generally a problem. There are also a number of ways of configuring things so that the Django application still appears to be mounted at the root of the site but with a subset of URLs being forwarded through to it. This can be explicitly dictated, or even done such that everything goes through to Django except for where static files exist in DocumentRoot corresponding to PHP and static files. Thus, in effect the file based resources take precedence. Remove a static file resource and it will automatically then push that URL through to Django with no change in configuration. Flexible configuration is one of Apache/mod_wsgi's strong points and there are many things one can do that the majority wouldn't ever need. Graham --~--~-~--~~~---~--~~ 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: hosting from /some/url in apache
On Oct 15, 5:14 am, Jani Tiainen wrote: > Chris Withers kirjoitti: > > Hi All, > > > I need to host my django project from /some/folder in my apache instance. > > > I have the following: > > > WSGIScriptAlias /some/folder /path/to/django.wsgi > > > Does this now mean I have to prefix all my entries in urls.py with > > /some/folder? > > > I hope not, but give that going to: > > >http://myserver/some/folder > > > ...gives me a 404 unless I do, I'm not hopeful. > > > What am I doing wrong? > > "nothing". > > Term is called "suburl deployment" and I've done it (for testing purposes). > > Apache config: > > RewriteEngine On > > #add missing trailing slash if needed > RewriteRule ^/$ // [R] This rewrite rule should not be required for things to work. Graham > #WSGI alias[[BR]] > WSGIScriptAlias / absolute_path_to_wsgi_file.wsgi[[BR]] > > And if you're using authentication in your app you must provided full > absolutely URL to login page, I've done it settings.py: > > LOGIN_URL='//login/' > > And that's it. Of course you have to keep all your apps using hardcoded > urls but use reverse url finding always. > > -- > Jani Tiainen --~--~-~--~~~---~--~~ 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: lighttpd and admin
Thanks That fixed it :) On Oct 14, 9:52 am, justquick wrote: > I have lighty setup for several of my projects using fastcgi and to > make them work, i had to set > > FORCE_SCRIPT_NAME = '' > > instead of > > FORCE_SCRIPT_NAME = '/' > > give that a try and see if {% url %} et al are still working > > On Oct 14, 11:22 am, "Mark (Nosrednakram)" > wrote: > > > Hello All, > > > I setup lighttpd and fastcgi the other day and everything seemed good > > until I tried to log into admin. It posts to "//admin" which in the > > browser is http:///admin without a host. I believe this is due to > > adding FORCE_SCRIPT_NAME="/" in my setting file which was required to > > make {% url %} and reverse work I believe. Is there a fix I haven't > > found? my lighttpd.conf with [CAPS] placeholders. Any thoughts on > > where to look? > > > server.modules = ( "mod_rewrite", > > "mod_redirect", > > "mod_fastcgi", > > "mod_alias", > > "mod_access", > > "mod_accesslog" ) > > > server.errorlog = "/opt/django/fastcgi/error.log" > > accesslog.filename = "/opt/django/fastcgi/access.log" > > > server.document-root = "/opt/django/html/" > > server.port = 8080 > > > mimetype.assign = ( > > ".pdf" => "application/pdf", > > ".jpg" => "image/jpeg", > > ".jpeg" => "image/jpeg", > > ".png" => "image/png", > > ".js" => "text/javascript", > > ".css" => "text/css", > > ".html" => "text/html", > > ".htm" => "text/html", > > ".gif" => "image/gif", > > "" => "application/octet-stream", > > ) > > > $HTTP["url"] =~ "^/media($|/)" { > > dir-listing.activate = "enable" > > } > > > $HTTP["host"] == "[HOSTNAME]" { > > url.redirect = ( "^/(.*)" => "http://[SERVER]/$1"; )} > > > $HTTP["host"] == "[SERVER]" { > > > fastcgi.server = ( > > "/mysite.fcgi" => ( > > "main" => ( > > "socket" => "/opt/django/fastcgi/[SERVER].socket", > > "check-local" => "disable", > > ) > > ) > > ) > > alias.url = ( > > "/media" => "/opt/django/[PROJECT]/site_media/", > > ) > > > url.rewrite-once = ( > > "^(/media.*)$" => "$1", > > "^(/.*)$" => "/mysite.fcgi$1" > > ) > > > } > > > Thank you, > > 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-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: djangocon videos
Yeah I would love to seem them too. Vitaly Babiy On Wed, Oct 14, 2009 at 10:44 AM, Aljosa Mohorovic < aljosa.mohoro...@gmail.com> wrote: > > anybody knows when djangocon september/portland videos will be > available? > > Aljosa Mohorovic > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Looking for programmer experienced in Python/Django/Git/Unix
Hi everyone, We're looking for an expert in Python, Django, Git and Unix. We have multiple projects needed paid on hourly basis. Do you have a strong confidence in all of these? If so, please provide a resume and a little bit about yourself in regards to these. Thank you, Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: hosting from /some/url in apache
2009/10/14 Jani Tiainen : > > Chris Withers kirjoitti: >> Hi All, >> >> I need to host my django project from /some/folder in my apache instance. >> >> I have the following: >> >> WSGIScriptAlias /some/folder /path/to/django.wsgi >> >> Does this now mean I have to prefix all my entries in urls.py with >> /some/folder? >> >> I hope not, but give that going to: >> >> http://myserver/some/folder >> >> ...gives me a 404 unless I do, I'm not hopeful. >> >> What am I doing wrong? > > "nothing". > > Term is called "suburl deployment" and I've done it (for testing purposes). > > Apache config: > > RewriteEngine On > > #add missing trailing slash if needed > RewriteRule ^/$ // [R] > > #WSGI alias[[BR]] > WSGIScriptAlias / absolute_path_to_wsgi_file.wsgi[[BR]] > > And if you're using authentication in your app you must provided full > absolutely URL to login page, I've done it settings.py: > > LOGIN_URL='//login/' > > And that's it. Of course you have to keep all your apps using hardcoded > urls but use reverse url finding always. > Does this enable you to run a django project only on a certain url? So, say for example you've got a legacy php site that has the siteroot, could you run a django app off of // ? Many Thanks, Dan > -- > Jani Tiainen > > > > -- Dan Hilton www.twitter.com/danhilton www.DanHilton.co.uk --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Multi-db support
Hi all, Am I wasting my time trying to figure out multi-db functionality. I know that Alex Gaynor is working on a GSOC project that is slatted for Django 1.2 release that deals with this, but I can't imagine that being released anytime soon. I've been able to configure a MultiDBManager for my test site, where I connect to a local mysql databased for admin, auth, session, etc and connect to a remote mysql to query 2 models. My problem occurs during larger queries - I get 'Too many connections' error. If I run these queries through django's default manager they are handled fine. Can anyone point me in the right direction, maybe the source code where django handles this. I'm pretty sure I need to close the connection in my MultiDBManager but not sure how to accomplish this. Thanks in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: hosting from /some/url in apache
Jani Tiainen wrote: >> What am I doing wrong? > > "nothing". Well, it turned out I was editing a backup copy of the apache config file :-( My bad. Once I started editing the right file, things worked as expected ;-) > And if you're using authentication in your app you must provided full > absolutely URL to login page, I've done it settings.py: > > LOGIN_URL='//login/' Surely this should respect SCRIPT_NAME just the same as everything else? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ 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: Django Developer Position in New York City, Urgent Stuff
Posting here more makes this persons vulgar comment more popular. Please also post your job offering on djangogigs.com so you may have maximum exposure. On Wed, Oct 14, 2009 at 2:31 PM, Shaun Hinklein (Sysmind L.L.C) < shaunhinkl...@gmail.com> wrote: > > What does this even mean? > "Mother fucker so many sending mail?" > > Are you incompetent in two languages and vulgarity? > > > On Oct 11, 11:33 am, Chhouk Voeun wrote: > > mother fucker so many sending mail i' m bored don't send > > > > On Sat, Oct 10, 2009 at 3:04 AM, Shaun Hinklein (Sysmind L.L.C) < > > > > shaunhinkl...@gmail.com> wrote: > > > > > Hey :) > > > I'm messaging all of you in regards to a Django Developer position > > > located in New York City. The position is extremely urgent and the > > > candidate would start probably next week. If you, or one of your > > > colleagues, is interested in this position, please contact me with > > > your resume at 609-897-9670 x104 or at my email at sh...@sysmind.com > > > Thanks for your time! > > > Sincerely, > > > Shaun > > > > > The stuff you care about: > > > There is no rate cap. > > > The rate is good. > > > -- http://www.goldwatches.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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Developer Position in New York City, Urgent Stuff
What does this even mean? "Mother fucker so many sending mail?" Are you incompetent in two languages and vulgarity? On Oct 11, 11:33 am, Chhouk Voeun wrote: > mother fucker so many sending mail i' m bored don't send > > On Sat, Oct 10, 2009 at 3:04 AM, Shaun Hinklein (Sysmind L.L.C) < > > shaunhinkl...@gmail.com> wrote: > > > Hey :) > > I'm messaging all of you in regards to a Django Developer position > > located in New York City. The position is extremely urgent and the > > candidate would start probably next week. If you, or one of your > > colleagues, is interested in this position, please contact me with > > your resume at 609-897-9670 x104 or at my email at sh...@sysmind.com > > Thanks for your time! > > Sincerely, > > Shaun > > > The stuff you care about: > > There is no rate cap. > > The rate is good. --~--~-~--~~~---~--~~ 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: hosting from /some/url in apache
Chris Withers kirjoitti: > Hi All, > > I need to host my django project from /some/folder in my apache instance. > > I have the following: > > WSGIScriptAlias /some/folder /path/to/django.wsgi > > Does this now mean I have to prefix all my entries in urls.py with > /some/folder? > > I hope not, but give that going to: > > http://myserver/some/folder > > ...gives me a 404 unless I do, I'm not hopeful. > > What am I doing wrong? "nothing". Term is called "suburl deployment" and I've done it (for testing purposes). Apache config: RewriteEngine On #add missing trailing slash if needed RewriteRule^/$ // [R] #WSGI alias[[BR]] WSGIScriptAlias / absolute_path_to_wsgi_file.wsgi[[BR]] And if you're using authentication in your app you must provided full absolutely URL to login page, I've done it settings.py: LOGIN_URL='//login/' And that's it. Of course you have to keep all your apps using hardcoded urls but use reverse url finding always. -- Jani Tiainen --~--~-~--~~~---~--~~ 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: When would you use Context instead of RequestContext?
So it's basically just an issue of optimization? Is using RequestContext best practice for apps meant to be pluggable? On Oct 14, 1:25 pm, justquick wrote: > it helps performance slightly since it does not include the request > itself or any of the other goodies in TEMPLATE_CONTEXT_PROCESSORS > > On Oct 14, 12:39 pm, ringemup wrote: > > > Is there ever a reason to pass a plain Context rather than a > > RequestContext when rendering a template? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Looking to hire python/django/git/unix expert
Looking to hire a python, django, git, and unix expert for various projects Pay is $70+/hr, please respond with resume, 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Can't get css working
Thanks JIm, didn't solve my problem, but always good to learn some best practices. Any particular reason why {'document_root' : os.path.join(settings.CURRENT_PATH,"media_site") }) is better than {'document_root': settings.MEDIA_ROOT} in settings.py? On 14 Okt., 18:17, Jim McGaw wrote: > Hi David, > > I don't anything wrong with what you've typed. I have one suggestion: > use the os.path module from Python to avoid hard-coding the paths to > your project. Inside of settings.py, you could add: > > import os > # CURRENT_PATH points to your project's root directory > # (the directory in which your settings.py file resides) > CURRENT_PATH = os.path.abspath(os.path.dirname(__file__) > > # points to /path/to/project/media_site/ > MEDIA_ROOT = os.path.join(CURRENT_PATH, "media_site") > > Then, back in urls.py, import your settings and use: > > { 'document_root' : os.path.join(settings.CURRENT_PATH, > "media_site") }) > > Just a suggestion to help troubleshoot the issue. The only other > thought I had is to remove the dash from the name of your project; > I've had problems with directories containing dashes in the past, but > don't spend too much time testing that, since I'm not sure why that > would be causing the problem here. > > Good luck! > > On Oct 14, 7:40 am, David wrote: > > > Hello > > I can't get my css working. > > I readhttp://docs.djangoproject.com/en/dev/howto/static-files/and > > many stack overflow and group entries, and I think I have what > > everybody hast that has it working, yet it doesn't work! > > > In settings.py: > > MEDIA_ROOT ="/home/myhome/workspaces/django-project/media_site/" > > MEDIA_URL = "/media_site/" > > ADMIN_MEDIA_PREFIX = "/media/" > > > in the template base.html: > > > > blabla > > > / > > > > > > in urls.py: > > patterns('', > > (r'^media_site/(?P.*)$', 'django.views.static.serve', > > {'document_root': settings.MEDIA_ROOT}), > > ... > > ) > > > from the terminal: > > david: media_site$ pwd > > /home/myhome/workspaces/django-project/media_site > > david: media_site$ ls > > style.css > > > I use the development server. The server outputs: > > [14/Oct/2009 16:27:41] "GET /media_site/style.css HTTP/1.1" 404 2118 > > > Any idea where I did anything wrong? a typo somewhere? > > Any help appreciated! > > > David --~--~-~--~~~---~--~~ 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: Admin Settings
try using 'foreign_key__field1' instead On Oct 14, 12:04 pm, freeav8r wrote: > Is it possible to do something like this: > > class MyModelAdmin(admin.ModelAdmin): > list_display = (‘field1’, field2’, ‘foreign_key’, ‘foreign_key.field1’, > foreign_key.field2’,) > > admin.site.register(MyModel, MyModelAdmin) > > ‘foreign_key’ works just fine, but ‘foreign_key.field1’ and > ‘foreign_key.field2’ error out. Any suggestions? --~--~-~--~~~---~--~~ 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: When would you use Context instead of RequestContext?
it helps performance slightly since it does not include the request itself or any of the other goodies in TEMPLATE_CONTEXT_PROCESSORS On Oct 14, 12:39 pm, ringemup wrote: > Is there ever a reason to pass a plain Context rather than a > RequestContext when rendering a template? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
displaying tree data in admin
I've created model Structure referenced to itself and filled it with my data. class Structure(models.Model): parent=models.ForeignKey('self', blank=True, null=True, related_name='child_set') title=models.CharField(max_length=100) Default admin interface shows my data as a plain list. What should I do to see my data in a tree? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Admin Settings
Is it possible to do something like this: class MyModelAdmin(admin.ModelAdmin): list_display = (‘field1’, field2’, ‘foreign_key’, ‘foreign_key.field1’, foreign_key.field2’,) admin.site.register(MyModel, MyModelAdmin) ‘foreign_key’ works just fine, but ‘foreign_key.field1’ and ‘foreign_key.field2’ error out. Any suggestions? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
When would you use Context instead of RequestContext?
Is there ever a reason to pass a plain Context rather than a RequestContext when rendering a template? --~--~-~--~~~---~--~~ 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: Can't get css working
Hi David, I don't anything wrong with what you've typed. I have one suggestion: use the os.path module from Python to avoid hard-coding the paths to your project. Inside of settings.py, you could add: import os # CURRENT_PATH points to your project's root directory # (the directory in which your settings.py file resides) CURRENT_PATH = os.path.abspath(os.path.dirname(__file__) # points to /path/to/project/media_site/ MEDIA_ROOT = os.path.join(CURRENT_PATH, "media_site") Then, back in urls.py, import your settings and use: { 'document_root' : os.path.join(settings.CURRENT_PATH, "media_site") }) Just a suggestion to help troubleshoot the issue. The only other thought I had is to remove the dash from the name of your project; I've had problems with directories containing dashes in the past, but don't spend too much time testing that, since I'm not sure why that would be causing the problem here. Good luck! On Oct 14, 7:40 am, David wrote: > Hello > I can't get my css working. > I readhttp://docs.djangoproject.com/en/dev/howto/static-files/and > many stack overflow and group entries, and I think I have what > everybody hast that has it working, yet it doesn't work! > > In settings.py: > MEDIA_ROOT ="/home/myhome/workspaces/django-project/media_site/" > MEDIA_URL = "/media_site/" > ADMIN_MEDIA_PREFIX = "/media/" > > in the template base.html: > > blabla > > > > in urls.py: > patterns('', > (r'^media_site/(?P.*)$', 'django.views.static.serve', > {'document_root': settings.MEDIA_ROOT}), > ... > ) > > from the terminal: > david: media_site$ pwd > /home/myhome/workspaces/django-project/media_site > david: media_site$ ls > style.css > > I use the development server. The server outputs: > [14/Oct/2009 16:27:41] "GET /media_site/style.css HTTP/1.1" 404 2118 > > Any idea where I did anything wrong? a typo somewhere? > Any help appreciated! > > David --~--~-~--~~~---~--~~ 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: lighttpd and admin
I have lighty setup for several of my projects using fastcgi and to make them work, i had to set FORCE_SCRIPT_NAME = '' instead of FORCE_SCRIPT_NAME = '/' give that a try and see if {% url %} et al are still working On Oct 14, 11:22 am, "Mark (Nosrednakram)" wrote: > Hello All, > > I setup lighttpd and fastcgi the other day and everything seemed good > until I tried to log into admin. It posts to "//admin" which in the > browser is http:///admin without a host. I believe this is due to > adding FORCE_SCRIPT_NAME="/" in my setting file which was required to > make {% url %} and reverse work I believe. Is there a fix I haven't > found? my lighttpd.conf with [CAPS] placeholders. Any thoughts on > where to look? > > server.modules = ( "mod_rewrite", > "mod_redirect", > "mod_fastcgi", > "mod_alias", > "mod_access", > "mod_accesslog" ) > > server.errorlog = "/opt/django/fastcgi/error.log" > accesslog.filename = "/opt/django/fastcgi/access.log" > > server.document-root = "/opt/django/html/" > server.port = 8080 > > mimetype.assign = ( > ".pdf" => "application/pdf", > ".jpg" => "image/jpeg", > ".jpeg" => "image/jpeg", > ".png" => "image/png", > ".js" => "text/javascript", > ".css" => "text/css", > ".html" => "text/html", > ".htm" => "text/html", > ".gif" => "image/gif", > "" => "application/octet-stream", > ) > > $HTTP["url"] =~ "^/media($|/)" { > dir-listing.activate = "enable" > } > > $HTTP["host"] == "[HOSTNAME]" { > url.redirect = ( "^/(.*)" => "http://[SERVER]/$1"; )} > > $HTTP["host"] == "[SERVER]" { > > fastcgi.server = ( > "/mysite.fcgi" => ( > "main" => ( > "socket" => "/opt/django/fastcgi/[SERVER].socket", > "check-local" => "disable", > ) > ) > ) > alias.url = ( > "/media" => "/opt/django/[PROJECT]/site_media/", > ) > > url.rewrite-once = ( > "^(/media.*)$" => "$1", > "^(/.*)$" => "/mysite.fcgi$1" > ) > > } > > Thank you, > 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-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 -~--~~~~--~~--~--~---
lighttpd and admin
Hello All, I setup lighttpd and fastcgi the other day and everything seemed good until I tried to log into admin. It posts to "//admin" which in the browser is http:///admin without a host. I believe this is due to adding FORCE_SCRIPT_NAME="/" in my setting file which was required to make {% url %} and reverse work I believe. Is there a fix I haven't found? my lighttpd.conf with [CAPS] placeholders. Any thoughts on where to look? server.modules = ( "mod_rewrite", "mod_redirect", "mod_fastcgi", "mod_alias", "mod_access", "mod_accesslog" ) server.errorlog = "/opt/django/fastcgi/error.log" accesslog.filename = "/opt/django/fastcgi/access.log" server.document-root = "/opt/django/html/" server.port= 8080 mimetype.assign = ( ".pdf" => "application/pdf", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".png" => "image/png", ".js" => "text/javascript", ".css" => "text/css", ".html" => "text/html", ".htm" => "text/html", ".gif" => "image/gif", "" => "application/octet-stream", ) $HTTP["url"] =~ "^/media($|/)" { dir-listing.activate = "enable" } $HTTP["host"] == "[HOSTNAME]" { url.redirect = ( "^/(.*)" => "http://[SERVER]/$1"; ) } $HTTP["host"] == "[SERVER]" { fastcgi.server = ( "/mysite.fcgi" => ( "main" => ( "socket" => "/opt/django/fastcgi/[SERVER].socket", "check-local" => "disable", ) ) ) alias.url = ( "/media" => "/opt/django/[PROJECT]/site_media/", ) url.rewrite-once = ( "^(/media.*)$" => "$1", "^(/.*)$" => "/mysite.fcgi$1" ) } Thank you, 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-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 -~--~~~~--~~--~--~---
hosting from /some/url in apache
Hi All, I need to host my django project from /some/folder in my apache instance. I have the following: WSGIScriptAlias /some/folder /path/to/django.wsgi Does this now mean I have to prefix all my entries in urls.py with /some/folder? I hope not, but give that going to: http://myserver/some/folder ...gives me a 404 unless I do, I'm not hopeful. What am I doing wrong? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ 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: new permission
def get_permission_object(perm_label): from django.contrib.contenttypes.models import ContentType from django.contrib.auth.models import Permission app_label,perm_code_name = perm_label.split('.') content_type = ContentType.objects.get(app_label=app_label) perm = Permission.objects.get (content_type=content_type,codename=perm_code_name) return perm def add_perm_to_user(user,perm_label): user.user_permissions.add(get_permission_object(perm_label)) user.save() return user >>> u=User.objects.get(username="test_ader1") >>> u=add_perm_to_user(u,'your_app_label.your_perm_label') your_app_label.your_perm_label ==> in your case, is "appname.total" On Oct 14, 2:58 am, Михаил Лукин wrote: > Try ./manage reset auth > > > > On Tue, Oct 13, 2009 at 1:08 PM, elminio wrote: > > > hi, > > > It didnt help :/ > > > On Oct 9, 10:33 am, "Bogdan I. Bursuc" > > wrote: > > > Try to delete the auth_permissions table the sync db > > > see if it helps > > > > On Fri, 2009-10-09 at 01:29 -0700,elminiowrote: > > > > Up Up > > > > > On Oct 8, 12:10 pm,elminio wrote: > > > > > Hi, > > > > > I've extended my model with new permission. > > > > > > class Meta: > > > > > permissions = ( > > > > > ("total", "total"), > > > > > ) > > > > > > After that I mafe manage.py syncdb. But after that when I wanted to > > > > > add user new privilage just created there wasn't it in admin panel > > > > > where you can choose permissions add and remove from user. > > > > > > thanks for help > > -- > regards, > Mihail --~--~-~--~~~---~--~~ 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: Field that's unique across several tables
On Oct 14, 11:03 am, Daniel Roseman wrote: > A better way might be to use model inheritance (multitable). The > parent model would just include the field you want to be unique, and > the subclassed models would include their own fields. You should be > able to set unique=True on that one field in the parent model, and it > should work. I've also found that the field's uniqueness is not enforced at the admin level. Instead, if I try to set the field for a model to a value duplicated in a model of a different type (but with the same base class) then I get an IntegrityError complaining saying "column is not unique". --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
djangocon videos
anybody knows when djangocon september/portland videos will be available? Aljosa Mohorovic --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Can't get css working
Hello I can't get my css working. I read http://docs.djangoproject.com/en/dev/howto/static-files/ and many stack overflow and group entries, and I think I have what everybody hast that has it working, yet it doesn't work! In settings.py: MEDIA_ROOT ="/home/myhome/workspaces/django-project/media_site/" MEDIA_URL = "/media_site/" ADMIN_MEDIA_PREFIX = "/media/" in the template base.html: blabla in urls.py: patterns('', (r'^media_site/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), ... ) from the terminal: david: media_site$ pwd /home/myhome/workspaces/django-project/media_site david: media_site$ ls style.css I use the development server. The server outputs: [14/Oct/2009 16:27:41] "GET /media_site/style.css HTTP/1.1" 404 2118 Any idea where I did anything wrong? a typo somewhere? Any help appreciated! David --~--~-~--~~~---~--~~ 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: Field that's unique across several tables
On Oct 14, 11:03 am, Daniel Roseman wrote: > A better way might be to use model inheritance (multitable). The > parent model would just include the field you want to be unique, and > the subclassed models would include their own fields. You should be > able to set unique=True on that one field in the parent model, and it > should work. That's a good idea, but what if one of my models is from an external package? Would I have to treat that one model as a special case? --~--~-~--~~~---~--~~ 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: Field that's unique across several tables
On Oct 14, 2:26 pm, Aaron wrote: > I have a bunch of models that each have a field X. I want this X to be > unique not just within a particular model (table) but unique across > several models. So, a model of type A can't have a value for its X if > that value is already in the X of a model of type B. > > I get the impression that I'd have to either subclass a model field or > a form field. A model field seems more appropriate, but I can't find > its equivalent of the form field's clean() method where it seems most > appropriate to do the uniqueness checks. A better way might be to use model inheritance (multitable). The parent model would just include the field you want to be unique, and the subclassed models would include their own fields. You should be able to set unique=True on that one field in the parent model, and it should work. -- 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-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: app model
Hi, I don't think there's an easy way. except that you customize your model save function -djibon- On 10/14/09, Zilva wrote: > > like auto_now_add > > > -- -- http://www.tumbletooth.org my linkedin profile : http://www.linkedin.com/in/bayuadji -- --~--~-~--~~~---~--~~ 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: check if user has already saved link
Thanks so much to you both, it's all working great :-) On Oct 14, 3:27 pm, "Michael P. Jung" wrote: > > return user.savelink_set.objects.filter(link=object).count() (...) > > The error i get now is : Caught an exception while rendering: > > 'RelatedManager' object has no attribute 'objects' > > user.savelink_set is already a Manager and does not have an attribute > "objects". Just write "user.savelink_set.filter(link=object).count()". > > --mp --~--~-~--~~~---~--~~ 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: check if user has already saved link
> return user.savelink_set.objects.filter(link=object).count() (...) > The error i get now is : Caught an exception while rendering: > 'RelatedManager' object has no attribute 'objects' user.savelink_set is already a Manager and does not have an attribute "objects". Just write "user.savelink_set.filter(link=object).count()". --mp --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Field that's unique across several tables
I have a bunch of models that each have a field X. I want this X to be unique not just within a particular model (table) but unique across several models. So, a model of type A can't have a value for its X if that value is already in the X of a model of type B. I get the impression that I'd have to either subclass a model field or a form field. A model field seems more appropriate, but I can't find its equivalent of the form field's clean() method where it seems most appropriate to do the uniqueness checks. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
What happened to djangopluggables.com?
I get a 502 bad gateway for http://djangopluggables.com/ - searched this group and found no mention of a planned downtime. Can anybody help? M --~--~-~--~~~---~--~~ 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: check if user has already saved link
ok, now it looks like from django import template register = template.Library() @register.filter("has_saved_link") def has_saved_link(user, object): return user.savelink_set.objects.filter(link=object).count() and then in the template it's like {% if user.is_authenticated and not user|has_saved_link:object %} The error i get now is : Caught an exception while rendering: 'RelatedManager' object has no attribute 'objects' Am i forgetting to include something else ? Thanks again On Oct 14, 2:55 pm, Daniel Roseman wrote: > On Oct 14, 1:36 pm, grimmus wrote: > > > > > Thanks for your reply. Here's what i did so far > > > i created a file called has_saved_link.py in my app's templatetags > > folder: > > > from django.template import Library, Node > > from django.db.models import get_model > > > register = Library() > > > def has_saved_link(user, object): > > return user.savedlink_set.objects.filter(link=object).count() > > > has_saved_link = register.tag(has_saved_link) > > > Then, in my template i load the tag > > > {% load has_saved_link %} > > > But if i try and use your syntax below i get errors > > > {% if user.is_authenticated and not user|has_saved_link:object %} - > > Error - Invalid filter: 'has_saved_link' > > {% if user.is_authenticated and not user.has_saved_link:object %} - > > Error - Could not parse the remainder: ':object' from > > 'user.has_saved_link:object' > > > I think it's an issue with how the objects are being passed to the > > tag ? > > > I'm a bit of a Noob with all this (as you can probably tell !!) > > > Thanks > > > On Oct 14, 12:16 pm, Daniel Roseman wrote: > > > > On Oct 14, 10:38 am, grimmus wrote: > > > > > Hi, > > > > > I have 2 Models, Link and SaveLink. > > > > > Link allows URL's with title's and descripions to be added to the > > > > site. > > > > SaveLink allows the logged in user to save their favourite links. > > > > > When i output all the links on the page i would like to check if the > > > > active user has already saved the current link. > > > > > Something like > > > > > {% if user.is_authenticated and not user.has_saved_link %} > > > > > > > href="{{object.get_save_url}}" class="save">Save > > > > {% else if user.is_authenticated and user.has_saved_link %} > > > > Already Saved > > > > {% else %} > > > > Login to save > > > > {% endif %} > > > > > I have not made the user.has_saved_link function yet and am unsure how > > > > to tackle this. Maybe i could pass the current context back to a > > > > function and compare it against what the user has already saved ? > > > > > Thanks in advance > > > > Assuming that 'object' is the link to save, and that there is a > > > foreign key from SavedLink to Link, your lookup needs to be something > > > like: > > > user.savedlink_set.objects.filter(link=object) > > > > So the question is how can we do that lookup in a template. I'd do it > > > as a filter, since these are easy to write and can be used in an {% if > > > %} tag. > > > > @register.filter > > > def has_saved_link(user, object) > > > return user.savedlink_set.objects.filter(link=object).count() > > > > Then you can do: > > > {% if user.is_authenticated and not user|has_saved_link:object %} > > > > -- > > > DR. > > Your problem is here: > has_saved_link = register.tag(has_saved_link) > > That should be: > has_saved_link = register.filter(has_saved_link) > > or, as I originally did, use the @register.filter syntax at the top of > the function. This is the preferred way of doing things except if > you're on Python 2.3. > -- > 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-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: django-friends error: 'Permission' object has no attribute 'verified'
Sorry the right line is if instance.verified: On Oct 14, 2:58 pm, "simonecare...@gmail.com" wrote: > Hi all, > > I'm trying to install django-friends into my project, but I get an > error while performing syncdb: > > File "/home/***/***/trunk/app/friends/models.py", line 208, in > new_user > if instance.verified(): > AttributeError: 'Permission' object has no attribute 'verified' > > I'm running on a Python2.5 Virtual Env, based on CentOS and Django > 1.1.1 > > I've seen on django-friends github page, and noticed another person > got the same error, but there are no replies. > > The Attribute Error is in the function: > > def new_user(sender, instance, **kwargs): > > in friends/model.py on line 208: > > if instance.verified(): > > I'm struggling on how to fix it. > Any suggestion? > > Thanks, > Simone. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
django-friends error: 'Permission' object has no attribute 'verified'
Hi all, I'm trying to install django-friends into my project, but I get an error while performing syncdb: File "/home/***/***/trunk/app/friends/models.py", line 208, in new_user if instance.verified(): AttributeError: 'Permission' object has no attribute 'verified' I'm running on a Python2.5 Virtual Env, based on CentOS and Django 1.1.1 I've seen on django-friends github page, and noticed another person got the same error, but there are no replies. The Attribute Error is in the function: def new_user(sender, instance, **kwargs): in friends/model.py on line 208: if instance.verified(): I'm struggling on how to fix it. Any suggestion? Thanks, Simone. --~--~-~--~~~---~--~~ 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: check if user has already saved link
On Oct 14, 1:36 pm, grimmus wrote: > Thanks for your reply. Here's what i did so far > > i created a file called has_saved_link.py in my app's templatetags > folder: > > from django.template import Library, Node > from django.db.models import get_model > > register = Library() > > def has_saved_link(user, object): > return user.savedlink_set.objects.filter(link=object).count() > > has_saved_link = register.tag(has_saved_link) > > Then, in my template i load the tag > > {% load has_saved_link %} > > But if i try and use your syntax below i get errors > > {% if user.is_authenticated and not user|has_saved_link:object %} - > Error - Invalid filter: 'has_saved_link' > {% if user.is_authenticated and not user.has_saved_link:object %} - > Error - Could not parse the remainder: ':object' from > 'user.has_saved_link:object' > > I think it's an issue with how the objects are being passed to the > tag ? > > I'm a bit of a Noob with all this (as you can probably tell !!) > > Thanks > > On Oct 14, 12:16 pm, Daniel Roseman wrote: > > > > > On Oct 14, 10:38 am, grimmus wrote: > > > > Hi, > > > > I have 2 Models, Link and SaveLink. > > > > Link allows URL's with title's and descripions to be added to the > > > site. > > > SaveLink allows the logged in user to save their favourite links. > > > > When i output all the links on the page i would like to check if the > > > active user has already saved the current link. > > > > Something like > > > > {% if user.is_authenticated and not user.has_saved_link %} > > > > > href="{{object.get_save_url}}" class="save">Save > > > {% else if user.is_authenticated and user.has_saved_link %} > > > Already Saved > > > {% else %} > > > Login to save > > > {% endif %} > > > > I have not made the user.has_saved_link function yet and am unsure how > > > to tackle this. Maybe i could pass the current context back to a > > > function and compare it against what the user has already saved ? > > > > Thanks in advance > > > Assuming that 'object' is the link to save, and that there is a > > foreign key from SavedLink to Link, your lookup needs to be something > > like: > > user.savedlink_set.objects.filter(link=object) > > > So the question is how can we do that lookup in a template. I'd do it > > as a filter, since these are easy to write and can be used in an {% if > > %} tag. > > > @register.filter > > def has_saved_link(user, object) > > return user.savedlink_set.objects.filter(link=object).count() > > > Then you can do: > > {% if user.is_authenticated and not user|has_saved_link:object %} > > > -- > > DR. Your problem is here: has_saved_link = register.tag(has_saved_link) That should be: has_saved_link = register.filter(has_saved_link) or, as I originally did, use the @register.filter syntax at the top of the function. This is the preferred way of doing things except if you're on Python 2.3. -- 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-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: check if user has already saved link
Thanks for your reply. Here's what i did so far i created a file called has_saved_link.py in my app's templatetags folder: from django.template import Library, Node from django.db.models import get_model register = Library() def has_saved_link(user, object): return user.savedlink_set.objects.filter(link=object).count() has_saved_link = register.tag(has_saved_link) Then, in my template i load the tag {% load has_saved_link %} But if i try and use your syntax below i get errors {% if user.is_authenticated and not user|has_saved_link:object %} - Error - Invalid filter: 'has_saved_link' {% if user.is_authenticated and not user.has_saved_link:object %} - Error - Could not parse the remainder: ':object' from 'user.has_saved_link:object' I think it's an issue with how the objects are being passed to the tag ? I'm a bit of a Noob with all this (as you can probably tell !!) Thanks On Oct 14, 12:16 pm, Daniel Roseman wrote: > On Oct 14, 10:38 am, grimmus wrote: > > > > > Hi, > > > I have 2 Models, Link and SaveLink. > > > Link allows URL's with title's and descripions to be added to the > > site. > > SaveLink allows the logged in user to save their favourite links. > > > When i output all the links on the page i would like to check if the > > active user has already saved the current link. > > > Something like > > > {% if user.is_authenticated and not user.has_saved_link %} > > > href="{{object.get_save_url}}" class="save">Save > > {% else if user.is_authenticated and user.has_saved_link %} > > Already Saved > > {% else %} > > Login to save > > {% endif %} > > > I have not made the user.has_saved_link function yet and am unsure how > > to tackle this. Maybe i could pass the current context back to a > > function and compare it against what the user has already saved ? > > > Thanks in advance > > Assuming that 'object' is the link to save, and that there is a > foreign key from SavedLink to Link, your lookup needs to be something > like: > user.savedlink_set.objects.filter(link=object) > > So the question is how can we do that lookup in a template. I'd do it > as a filter, since these are easy to write and can be used in an {% if > %} tag. > > @register.filter > def has_saved_link(user, object) > return user.savedlink_set.objects.filter(link=object).count() > > Then you can do: > {% if user.is_authenticated and not user|has_saved_link:object %} > > -- > 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-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 -~--~~~~--~~--~--~---
django.contrib.auth.tests.__test__.BASIC_TESTS fails with IntegrityError: (1062, "Duplicate entry 'testuser' for key 2") using mysql
Hi all, I'm using latest svn django with mysql. I'm getting the failure below when I run 'python manage.py test'. The failing lines seem to be: BASIC_TESTS = """ >>> from django.contrib.auth.models import User, AnonymousUser >>> u = User.objects.create_user('testuser', 't...@example.com', 'testpw') But when I run 'python manage.py shell': In [1]: from django.contrib.auth.models import User, AnonymousUser In [2]: u = User.objects.create_user('testuser', 't...@example.com', 'testpw') In [3]: u.has_usable_password() Out[3]: True It works!? The error I'm seeing from manage.py test is below. Any ideas? Couldn't see any errors in the mysql log. $ python manage.py test /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: DeprecationWarning: the sets module is deprecated from sets import ImmutableSet Creating test database... Creating table auth_permission Creating table auth_group Creating table auth_user Creating table auth_message Creating table django_content_type Creating table django_session Creating table django_site Creating table django_admin_log Creating table whitelist_whitelist Installing index for auth.Permission model Installing index for auth.Message model Installing index for admin.LogEntry model Installing index for whitelist.Whitelist model ...F. == FAIL: Doctest: django.contrib.auth.tests.__test__.BASIC_TESTS -- Traceback (most recent call last): File "/usr/lib/python2.6/dist-packages/django/test/_doctest.py", line 2180, in runTest raise self.failureException(self.format_failure(new.getvalue())) AssertionError: Failed doctest test for django.contrib.auth.tests.__test__.BASIC_TESTS File "/usr/lib/python2.6/dist-packages/django/contrib/auth/tests/ __init__.py", line unknown line number, in BASIC_TESTS -- File "/usr/lib/python2.6/dist-packages/django/contrib/auth/tests/ __init__.py", line ?, in django.contrib.auth.tests.__test__.BASIC_TESTS Failed example: u = User.objects.create_user('testuser', 't...@example.com', 'testpw') Exception raised: Traceback (most recent call last): File "/usr/lib/python2.6/dist-packages/django/test/_doctest.py", line 1267, in __run compileflags, 1) in test.globs File "", line 1, in u = User.objects.create_user('testuser', 't...@example.com', 'testpw') File "/usr/lib/python2.6/dist-packages/django/contrib/auth/ models.py", line 105, in create_user user.save() File "/usr/lib/python2.6/dist-packages/django/db/models/ base.py", line 410, in save self.save_base(force_insert=force_insert, force_update=force_update) File "/usr/lib/python2.6/dist-packages/django/db/models/ base.py", line 495, in save_base result = manager._insert(values, return_id=update_pk) File "/usr/lib/python2.6/dist-packages/django/db/models/ manager.py", line 177, in _insert return insert_query(self.model, values, **kwargs) File "/usr/lib/python2.6/dist-packages/django/db/models/ query.py", line 1087, in insert_query return query.execute_sql(return_id) File "/usr/lib/python2.6/dist-packages/django/db/models/sql/ subqueries.py", line 320, in execute_sql cursor = super(InsertQuery, self).execute_sql(None) File "/usr/lib/python2.6/dist-packages/django/db/models/sql/ query.py", line 2369, in execute_sql cursor.execute(sql, params) File "/usr/lib/python2.6/dist-packages/django/db/backends/mysql/ base.py", line 84, in execute return self.cursor.execute(query, args) File "/var/lib/python-support/python2.6/MySQLdb/cursors.py", line 166, in execute self.errorhandler(self, exc, value) File "/var/lib/python-support/python2.6/MySQLdb/connections.py", line 35, in defaulterrorhandler raise errorclass, errorvalue IntegrityError: (1062, "Duplicate entry 'testuser' for key 2") --~--~-~--~~~---~--~~ 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: app model
like auto_now_add --~--~-~--~~~---~--~~ 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: does this get or create code ship with django?
Russell Keith-Magee kirjoitti: > On Wed, Oct 14, 2009 at 7:09 PM, Chris Withers wrote: >> Hi All, >> >> I have a function that looks like: >> >> def get_or_create(model,**kw): >> try: >> obj = model.objects.get(**kw) >> except model.DoesNotExist: >> obj = model(**kw) >> return model >> >> Does something like this ship with django? > > http://docs.djangoproject.com/en/dev/ref/models/querysets/#get-or-create-kwargs And to avoid situation that I had (just because I didn't read docs carefully) standard get_or_create actually always creates instance in to database. I first tried to use it just as a template to get object if it didn't existed but it turned out to provide a bit undesired effects, specially with missing null fields... :) -- Jani Tiainen --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
app model
Hi, seeking a way how user ID automatically add in to the integer field, Django model. Would anyone know any simple solution? --~--~-~--~~~---~--~~ 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: does this get or create code ship with django?
On Wed, Oct 14, 2009 at 7:09 PM, Chris Withers wrote: > > Hi All, > > I have a function that looks like: > > def get_or_create(model,**kw): > try: > obj = model.objects.get(**kw) > except model.DoesNotExist: > obj = model(**kw) > return model > > Does something like this ship with django? http://docs.djangoproject.com/en/dev/ref/models/querysets/#get-or-create-kwargs 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
does this get or create code ship with django?
Hi All, I have a function that looks like: def get_or_create(model,**kw): try: obj = model.objects.get(**kw) except model.DoesNotExist: obj = model(**kw) return model Does something like this ship with django? If not, should it? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ 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: newbie. need help in validation
On Oct 14, 10:42 am, Kenneth Gonsalves wrote: > On Wednesday 14 Oct 2009 3:08:00 pm robin nanola wrote: > > > try reading this > >http://www.cotellese.net/2007/12/11/adding-model-field-validation-to-... > >ango-admin-page/ > > I do not think validators exist in django now - that blog post was done in > 2007. That's correct, the code in that post will not work. The way to do it now is to define a custom form and do the validation there, then set the modeladmin class for your model to use that custom form. -- 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-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: newbie. need help in validation
On 14 Oct 02:34, danin wrote: > > hi guys, > I am new to Django (started 2 weeks back). right now i am > designing one application having model- > class info(models.Model): >name=models.CharField(max_length=100) >dob=models.DateField() >dod=models.DateField() >address=models.CharField(max_length=250) >pin=IntegerField(msx_length=10) > > I am entering data in database via admin CRUD. but while entering the > data i want to perform some validations like : > 1. No negative number in pin field. > 2. dob > can anyone please guide me in this. i am not able to fiure out where > to performed this validation and how. I think the document you're looking for is: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin If you read all of that page, then I'm sure the custom validation will make sense. Thanks, -- Brett Parker --~--~-~--~~~---~--~~ 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: newbie. need help in validation
On Wednesday 14 Oct 2009 3:08:00 pm robin nanola wrote: > try reading this > http://www.cotellese.net/2007/12/11/adding-model-field-validation-to-the-dj >ango-admin-page/ I do not think validators exist in django now - that blog post was done in 2007. -- regards kg http://lawgon.livejournal.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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: newbie. need help in validation
On Wednesday 14 Oct 2009 3:04:10 pm danin wrote: > I am new to Django (started 2 weeks back). right now i am > designing one application having model- > class info(models.Model): >name=models.CharField(max_length=100) >dob=models.DateField() >dod=models.DateField() >address=models.CharField(max_length=250) >pin=IntegerField(msx_length=10) > > I am entering data in database via admin CRUD. but while entering the > data i want to perform some validations like : > 1. No negative number in pin field. > 2. dob > can anyone please guide me in this. i am not able to fiure out where > to performed this validation and how. One way would be to override your save() method - do the validation and then save, if it does not pass the validation raise an error. -- regards kg http://lawgon.livejournal.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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: looking for simple comment app
On Wednesday 14 Oct 2009 12:47:34 pm andreas schmid wrote: > im looking for a simple comment app. > i need commmenting for instances only by logged in users and the author > is obviously request.user, dont need any preview or whatever. maybe a > mail notification on instances i commented on. > > what are you using? I use contrib.comments, but only use a subset of the features and restrict comments to logged in users - works well for me. I use a simple {% if request.user.is_authenticated %} to keep non logged in users from commenting. I agree that this is not the best way as somecan break it, but works well enough for the type of user I get. You could use signals to send email notifications. -- regards kg http://lawgon.livejournal.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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Replacing description field in syndication RSS feed
I can create an RSS feed using the documentation for syndication and have tried to extend it using the MediaRSS format as described here: http://www.djangosnippets.org/snippets/1648/. This works up to a point: I'm testing with Firefox and it still doesn't display the media: extensions, but that's by the by at the moment. I would like to put a thumbnail image in the description field, and replace the content with my product description, but I can't work out how to override the default description field. I have tried defining description() and item_description() in my code but neither seems to work. I would try using the template system but the documentation is seemingly nonexistent for this. Cany anyone shed any light on what I should be doing? Thanks Simon --~--~-~--~~~---~--~~ 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: check if user has already saved link
On Oct 14, 10:38 am, grimmus wrote: > Hi, > > I have 2 Models, Link and SaveLink. > > Link allows URL's with title's and descripions to be added to the > site. > SaveLink allows the logged in user to save their favourite links. > > When i output all the links on the page i would like to check if the > active user has already saved the current link. > > Something like > > {% if user.is_authenticated and not user.has_saved_link %} > href="{{object.get_save_url}}" class="save">Save > {% else if user.is_authenticated and user.has_saved_link %} > Already Saved > {% else %} > Login to save > {% endif %} > > I have not made the user.has_saved_link function yet and am unsure how > to tackle this. Maybe i could pass the current context back to a > function and compare it against what the user has already saved ? > > Thanks in advance Assuming that 'object' is the link to save, and that there is a foreign key from SavedLink to Link, your lookup needs to be something like: user.savedlink_set.objects.filter(link=object) So the question is how can we do that lookup in a template. I'd do it as a filter, since these are easy to write and can be used in an {% if %} tag. @register.filter def has_saved_link(user, object) return user.savedlink_set.objects.filter(link=object).count() Then you can do: {% if user.is_authenticated and not user|has_saved_link:object %} -- 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-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: request.META['REMOTE_USER']
On Oct 14, 10:39 am, luca72 wrote: > Thanks but have you got idea why i get this error, request.user return > the correct value, but for my understanding also the META > ['REMOTE_USER'] has to give the same value. No, that's not true, and the documentation doesn't say it does. The values in META are the headers which are passed by the web server. They are set before anything gets into Django, so things like the Django authentication framework don't affect them at all. The REMOTE_USER header would be set, if at all, by any webserver-based authentication, such as Apache's. -- 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-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: request.META['REMOTE_USER']
read the explanation here http://docs.djangoproject.com/en/dev/howto/auth-remote-user/ On Wed, Oct 14, 2009 at 5:39 PM, luca72 wrote: > > Thanks but have you got idea why i get this error, request.user return > the correct value, but for my understanding also the META > ['REMOTE_USER'] has to give the same value. > > On 14 Ott, 11:34, robin nanola wrote: > > try request.user > > > > you get a key error coz there is no 'REMOTE_USER' key in META. > > > > On Wed, Oct 14, 2009 at 5:29 PM, luca72 wrote: > > > > > Hello if i use request.META['REMOTE_USER'] i get key error, but if i > > > use 'REMOTE_HOST' not > > > can you tell me how to get the user that is authenticate > > > I use the decorator @login_required and so the user is authenticated > > > correct? > > > > > Regards > > > > > Luca > > > --~--~-~--~~~---~--~~ 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: request.META['REMOTE_USER']
hi, imho request.user.is_authenticated and request.user.is_anonymous -djibon- On 10/14/09, robin nanola wrote: > try request.user > > you get a key error coz there is no 'REMOTE_USER' key in META. > > On Wed, Oct 14, 2009 at 5:29 PM, luca72 wrote: > >> >> Hello if i use request.META['REMOTE_USER'] i get key error, but if i >> use 'REMOTE_HOST' not >> can you tell me how to get the user that is authenticate >> I use the decorator @login_required and so the user is authenticated >> correct? >> >> Regards >> >> Luca >> > >> > > > > -- -- http://www.tumbletooth.org my linkedin profile : http://www.linkedin.com/in/bayuadji -- --~--~-~--~~~---~--~~ 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: request.META['REMOTE_USER']
Thanks but have you got idea why i get this error, request.user return the correct value, but for my understanding also the META ['REMOTE_USER'] has to give the same value. On 14 Ott, 11:34, robin nanola wrote: > try request.user > > you get a key error coz there is no 'REMOTE_USER' key in META. > > On Wed, Oct 14, 2009 at 5:29 PM, luca72 wrote: > > > Hello if i use request.META['REMOTE_USER'] i get key error, but if i > > use 'REMOTE_HOST' not > > can you tell me how to get the user that is authenticate > > I use the decorator @login_required and so the user is authenticated > > correct? > > > Regards > > > Luca --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
check if user has already saved link
Hi, I have 2 Models, Link and SaveLink. Link allows URL's with title's and descripions to be added to the site. SaveLink allows the logged in user to save their favourite links. When i output all the links on the page i would like to check if the active user has already saved the current link. Something like {% if user.is_authenticated and not user.has_saved_link %} Save {% else if user.is_authenticated and user.has_saved_link %} Already Saved {% else %} Login to save {% endif %} I have not made the user.has_saved_link function yet and am unsure how to tackle this. Maybe i could pass the current context back to a function and compare it against what the user has already saved ? Thanks in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: newbie. need help in validation
try reading this http://www.cotellese.net/2007/12/11/adding-model-field-validation-to-the-django-admin-page/ On Wed, Oct 14, 2009 at 5:34 PM, danin wrote: > > hi guys, >I am new to Django (started 2 weeks back). right now i am > designing one application having model- > class info(models.Model): > name=models.CharField(max_length=100) > dob=models.DateField() > dod=models.DateField() > address=models.CharField(max_length=250) > pin=IntegerField(msx_length=10) > > I am entering data in database via admin CRUD. but while entering the > data i want to perform some validations like : > 1. No negative number in pin field. > 2. dob > can anyone please guide me in this. i am not able to fiure out where > to performed this validation and how. > > > Thanks. > Danin > > > > --~--~-~--~~~---~--~~ 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: request.META['REMOTE_USER']
On Wed, 2009-10-14 at 02:29 -0700, luca72 wrote: > Hello if i use request.META['REMOTE_USER'] i get key error, but if i > use 'REMOTE_HOST' not > can you tell me how to get the user that is authenticate > I use the decorator @login_required and so the user is authenticated > correct? > > Regards > > Luca Simply look at request.user. See [1]. Cheers Tom [1] http://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: request.META['REMOTE_USER']
try request.user you get a key error coz there is no 'REMOTE_USER' key in META. On Wed, Oct 14, 2009 at 5:29 PM, luca72 wrote: > > Hello if i use request.META['REMOTE_USER'] i get key error, but if i > use 'REMOTE_HOST' not > can you tell me how to get the user that is authenticate > I use the decorator @login_required and so the user is authenticated > correct? > > Regards > > Luca > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
newbie. need help in validation
hi guys, I am new to Django (started 2 weeks back). right now i am designing one application having model- class info(models.Model): name=models.CharField(max_length=100) dob=models.DateField() dod=models.DateField() address=models.CharField(max_length=250) pin=IntegerField(msx_length=10) I am entering data in database via admin CRUD. but while entering the data i want to perform some validations like : 1. No negative number in pin field. 2. dobhttp://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: request.META['REMOTE_USER']
On Oct 14, 10:29 am, luca72 wrote: > Hello if i use request.META['REMOTE_USER'] i get key error, but if i > use 'REMOTE_HOST' not > can you tell me how to get the user that is authenticate > I use the decorator @login_required and so the user is authenticated > correct? > > Regards > > Luca request.user -- 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-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 -~--~~~~--~~--~--~---
request.META['REMOTE_USER']
Hello if i use request.META['REMOTE_USER'] i get key error, but if i use 'REMOTE_HOST' not can you tell me how to get the user that is authenticate I use the decorator @login_required and so the user is authenticated correct? Regards Luca --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Simple 'static' sitemap
For anyone looking for the most basic "static" sitemap you could use: Views. def dlsitemap(request): sitemap_data = open('path/to/templates/sitemap.xml',).read() return HttpResponse(sitemap_data, mimetype="text/xml") URLS (r'^sitemap\.xml$', 'dlsitemap'), All the examples I found where for dynamic sitemaps. (Please correct any errors) --~--~-~--~~~---~--~~ 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: looking for simple comment app
this article helped me a lot! http://www.yashh.com/blog/2008/nov/21/django-comments-authenticated-users/ On 14 Ott, 09:17, andreas schmid wrote: > hi, > > im looking for a simple comment app. > i need commmenting for instances only by logged in users and the author > is obviously request.user, dont need any preview or whatever. maybe a > mail notification on instances i commented on. > > what are you using? > > i tried django.contrib.comments but its already too much for my taste > and has too many fields. > today i wanted to test django-reviews but it doesnt work even with the > simple howto onhttp://packages.python.org/django-reviews/because i > cant find any sample tamplates to make it work and the example in the > package is an empty module. > > thank you! --~--~-~--~~~---~--~~ 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: read static file error
> whether you are create a directory in your settings.py. yes. I want some directories created automatically after import settings.py, and before any views/models process.It seems that developer couldn't do CREATE folder in settings.py without DEBUG mode. On Oct 10, 10:39 am, Bayuadji wrote: > Hi Shuge Lee, > > On 10/9/09, Shuge Lee wrote: > > > > > > > > > Environment: ubuntu 9.04 + django 1.1 + apache 2.* > > > I did followinghttps://wiki.ubuntu.com/Django > > > however, I got this error message > >http://dpaste.com/105064/ > > > My configure file: > > cat /etc/apache2/sites-available/online > >http://dpaste.com/105065/ > > > The file and path structure of my django project: > >http://dpaste.com/105066/ > > > r...@shuge-lab:/var/www# ls -l /home/share/shuge/shuge-online/ > > online/ | grep static > > drwxrwxrwx 10 li li 4096 2009-10-08 18:25 static > > I just wondering, whether you are create a directory in your settings.py. > because the error comes after import your settings.py > > cheers > -djibon- > > --http://www.tumbletooth.org > my linkedin profile :http://www.linkedin.com/in/bayuadji > -- --~--~-~--~~~---~--~~ 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: tagging case problem
Awesome, works great, thanks alot On Oct 14, 9:20 am, Bayuadji wrote: > hi, > > >>tag = Tag.objects.get(name=unslug) > > how about change that into: > tag = Tag.objects.get(name__iexact=unslug) > so it not case > sensitive.http://docs.djangoproject.com/en/dev/ref/models/querysets/#ref-models... > > -djibon- > > On 10/14/09, grimmus wrote: > > > > > > > Hi, > > > I followed the excellent Web Monkey tutorial on setting up a blog > > using Django. It makes use of Django Tagging. If a tag is entered like > > 'Tag' it is not found if you search for 'tag' . I would like it so the > > case of the tag doesnt matter because when i apply slugify in my > > template the tag gets converted to lowercase. > > > Tag_views.py > > > def tag_detail(request, slug): > > unslug = slug.replace('-', ' ') > > tag = Tag.objects.get(name=unslug) > > > qs = TaggedItem.objects.get_by_model(Link, tag) > > return object_list(request, queryset=qs, extra_context= > > {'tag':slug}, template_name='tags/detail.html') > > > def tag_list(request): > > tags = Tag.objects.all() > > return object_list(request,queryset=tags, template_name='tags/ > > list.html') > > > In my template > > > tags: {% for tag in object.get_tags %}{{tag}} {% endfor %} > > > Of course i could remove slugify but there must be an easy way to > > ignore the case of the tag ?? > > > Thanks in advance > > -- > --http://www.tumbletooth.org > my linkedin profile :http://www.linkedin.com/in/bayuadji > -- --~--~-~--~~~---~--~~ 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: Just upgraded to 1.1, can't start development server, TypeError
Seems like, some of the apps that you have in settings.py INSTALLED_APPS are there in the pythonpath for python2.5 and not for python2.6. You will need to do a easy_install-2.6 (or a corresponding pip/distribute equivalent) package_name On Wed, Oct 14, 2009 at 11:48 AM, eculver wrote: > > I just tried upgrade to django 1.1, ran ./manage.py runserver, but was > promptly halted due to this exception: > > ... > > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ > site-packages/django/utils/translation/trans_real.py", line 180, in > _fetch >app = import_module(appname) > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ > python2.6/site-packages/django/utils/importlib.py", line 35, in > import_module >__import__(name) > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ > python2.6/site-packages/django/contrib/admin/__init__.py", line 1, in > >from django.contrib.admin.options import ModelAdmin, HORIZONTAL, > VERTICAL > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ > python2.6/site-packages/django/contrib/admin/options.py", line 5, in > >from django.contrib.contenttypes.models import ContentType > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ > python2.6/site-packages/django/contrib/contenttypes/models.py", line > 1, in >from django.db import models > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ > python2.6/site-packages/django/db/__init__.py", line 57, in >'TIME_ZONE': settings.TIME_ZONE, > TypeError: __init__() takes exactly 1 argument (2 given) > > Everything worked fine in 1.0.4 before the upgrade. Seems like it may > be an obvious upgrade problem/oversight on my part. Any ideas? > > > -- Regards, Lakshman becomingguru.com lakshmanprasad.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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to confirm a successfull/failed database insert call to the user
Alternately, if you are working with anonymous users you can use anonymous sessions to get the same effect: http://docs.djangoproject.com/en/dev/topics/http/sessions/ Hector Garcia - Web developer, musician http://nomadblue.com/ On Tue, Oct 13, 2009 at 11:03 PM, Sonal Breed wrote: > > Thanks a lot Mihail :-) > Really appreciate it. > > Thanks, > Sincerely, > Sonal. > > On Oct 13, 1:53 pm, Михаил Лукин wrote: >> First of all, you don't need to check request.method == 'POST' twice; you >> don't need to check action here. >> Finally, you can use user messages to add and display confirmations: >> in view:http://docs.djangoproject.com/en/dev/topics/auth/#messages >> >> Put messages in base template and you can see them even after redirect. >> >> >> >> On Wed, Oct 14, 2009 at 12:39 AM, Sonal Breed wrote: >> >> > Hi all, >> >> > I need to show a confirm message when the data is saves successfully >> > in the database. >> > My view function snippet is as following: >> >> > def itemSave(request, id=None, d={}): >> > if request.method == "POST": >> > if request.method == "POST" and form.is_valid(): >> > if action == 'Save': >> > item = form.save(commit=False) >> > item.creator= request.user >> >> > try: >> > item.save() >> > d['saveMessage'] = "item Saved!" >> > except Exception: >> > d['saveMessage'] = "Error Occurred In Saving item.." >> >> > return HttpResponseRedirect("/item/%d" % item.id) >> >> > return render(request, 'createItem.html', d) >> >> > Template has: >> > {% if saveMessage %} >> > {{ saveMessage }} >> > {% endif %} >> >> > Now I want to stay on the same page (createItem) after save, which is >> > done bu calling return HttpResponseRedirect("/item/%d" % item.id) in >> > view code. >> >> > Therefore, the variable saveMessage retains its value and is displayed >> > in the page. But If I go to the createItem page by any other route, >> > say home>createITem, still this value persists, and even on empty new >> > form , I get to see "Item saved". If I reset the value of the var at >> > the begining of the view function, the value is always reset as it is >> > getting redirected to the same function. >> >> > How do I confirm a successfull/failed database insert call to the >> > user? >> >> > Thanks, >> >> > Sincerely, >> > Sonal. >> >> -- >> regards, >> Mihail > > > --~--~-~--~~~---~--~~ 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: tagging case problem
hi, >>tag = Tag.objects.get(name=unslug) how about change that into: tag = Tag.objects.get(name__iexact=unslug) so it not case sensitive. http://docs.djangoproject.com/en/dev/ref/models/querysets/#ref-models-querysets -djibon- On 10/14/09, grimmus wrote: > > Hi, > > I followed the excellent Web Monkey tutorial on setting up a blog > using Django. It makes use of Django Tagging. If a tag is entered like > 'Tag' it is not found if you search for 'tag' . I would like it so the > case of the tag doesnt matter because when i apply slugify in my > template the tag gets converted to lowercase. > > Tag_views.py > > def tag_detail(request, slug): > unslug = slug.replace('-', ' ') > tag = Tag.objects.get(name=unslug) > > qs = TaggedItem.objects.get_by_model(Link, tag) > return object_list(request, queryset=qs, extra_context= > {'tag':slug}, template_name='tags/detail.html') > > def tag_list(request): > tags = Tag.objects.all() > return object_list(request,queryset=tags, template_name='tags/ > list.html') > > In my template > > tags: {% for tag in object.get_tags %}{{tag}} {% endfor %} > > Of course i could remove slugify but there must be an easy way to > ignore the case of the tag ?? > > Thanks in advance > > > -- -- http://www.tumbletooth.org my linkedin profile : http://www.linkedin.com/in/bayuadji -- --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
looking for simple comment app
hi, im looking for a simple comment app. i need commmenting for instances only by logged in users and the author is obviously request.user, dont need any preview or whatever. maybe a mail notification on instances i commented on. what are you using? i tried django.contrib.comments but its already too much for my taste and has too many fields. today i wanted to test django-reviews but it doesnt work even with the simple howto on http://packages.python.org/django-reviews/ because i cant find any sample tamplates to make it work and the example in the package is an empty module. thank you! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
tagging case problem
Hi, I followed the excellent Web Monkey tutorial on setting up a blog using Django. It makes use of Django Tagging. If a tag is entered like 'Tag' it is not found if you search for 'tag' . I would like it so the case of the tag doesnt matter because when i apply slugify in my template the tag gets converted to lowercase. Tag_views.py def tag_detail(request, slug): unslug = slug.replace('-', ' ') tag = Tag.objects.get(name=unslug) qs = TaggedItem.objects.get_by_model(Link, tag) return object_list(request, queryset=qs, extra_context= {'tag':slug}, template_name='tags/detail.html') def tag_list(request): tags = Tag.objects.all() return object_list(request,queryset=tags, template_name='tags/ list.html') In my template tags: {% for tag in object.get_tags %}{{tag}} {% endfor %} Of course i could remove slugify but there must be an easy way to ignore the case of the tag ?? Thanks in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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 -~--~~~~--~~--~--~---