Re: Filtering the filters in Django Admin
I dont think there's a trivial way to do this. You might end up hacking into the django code itself. -- Gladys http://bixly.com On Feb 20, 5:58 am, SimpleDimple wrote: > Here is my code for a school projecthttp://dpaste.com/434311/ > > The code works fine, on studentadmin list page, I get filter for > classes > which is good but as you can see my project is multi-tenant so in > filter > area I want to show only the classes for the school the current user > is > logged in (tracked thru sessions) but right now I can see list of all > classes from all schools > > so I want to replace this line > list_filter = ['xclass'] > > with something like > list_filter = > Class.objects.filter(school=request.session['school_id']) > > how can I do it ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: testing foo_set existence for each object in a queryset
Dan, If I understand your question correctly, you are struggling with creating the filtering you wrote in your message on the queryset level (without going to the db for each object), right? Hard to say without actually seeing your code and testing, but would this be the same? MyModel.objects.filter(foo_set__endtime__gt == datetime.datetime.now()) I don't think you'll need the exists, as only existing objects will come back from the query. On Feb 20, 3:50 am, Dan wrote: > Hi, > > Long time lurker - first time poster - hopefully future answerer... > > Basically what I want to do can be done with: > > result = [w for w in MyModel.objects.all() if > w.foo_set.filter(endtime__gt = datetime.datetime.now()).exists()] > > Is there anyway to do this using the queryset api? > > Hopefully it's not too stupid a question... -- 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: testing foo_set existence for each object in a queryset
Not only is it not a stupid question, but it's one of the best possible types of questions. Any time someone comes in and makes it obvious that they've thought about their problem and made an attempt to solve it themselves, they get my respect. The easiest answer to your question is to make a custom manager (a subclass of models.Manager) for your model. http://docs.djangoproject.com/en/1.2/topics/db/managers/ You can add your logic to an override of the get() of filter(), or add an entirely new method, such as pending() or ready_to_send(). If your data grows to the point where this becomes unwieldy, you could speed things up by using signals, so that instances of the model represented by 'foo' in your example would update a field in your main model when they are created, changed, or deleted. This would allow you to use metadata in your main model instead of having to do the extra joins on every database read. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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.
testing foo_set existence for each object in a queryset
Hi, Long time lurker - first time poster - hopefully future answerer... Basically what I want to do can be done with: result = [w for w in MyModel.objects.all() if w.foo_set.filter(endtime__gt = datetime.datetime.now()).exists()] Is there anyway to do this using the queryset api? Hopefully it's not too stupid a question... -- 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: South - when to start?
On Sat, Feb 19, 2011 at 8:28 PM, Rainy wrote: > I was going to say the exact same thing. I can just add that anything > is fairly > easy with South - starting from the beginning, starting just before > 2nd > dev joins in, or even starting after other devs join. Wiping out old > migrations > is also easy. > > -Rainyday Yes. In fact, in our company we wiped out our South stuff and started over after almost two years (and many dozens of migrations across several apps). We have the history in git, and didn't need the overhead. When one app has over 70 migrations, unit testing becomes pretty daunting. All you have to do is wipe out the south_migrationhistory table and delete the migrations, and it's like it's South's first day on the job. It's great! Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: South - when to start?
On Feb 18, 10:59 am, ShawnMilo wrote: > Just to add my tiny bit to this: > > I say start with South right away. But when you're ready to deploy for the > first time, wipe it all and to another --initial. > > The reason is that South is awesome for letting you upgrade a production app > that isn't allowed to stop working. So at first deployment, it's nice to > start clean so you don't have all those extra migrations for each run of > your unittests, etc. > > Shawn I was going to say the exact same thing. I can just add that anything is fairly easy with South - starting from the beginning, starting just before 2nd dev joins in, or even starting after other devs join. Wiping out old migrations is also easy. -Rainyday -- 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: urls.py and views.generic issue
Hi Antti, the url patterns in the tutorial are not correct. The regular expressions are not using character classes but merely plain characters. ^blog/ ^(?Pd{4})/$ should be ^blog/ ^(?P\d{4})/$ Mind the backslash in \d{4}. This way we're matching for a sequence of four digits and not for a sequence of four "d"s. Regards, jnns On Feb 20, 12:57 am, Antti wrote: > The problem: > > I can't seem to get most of my urls that I type in my browser to math > a url in my urls.py file. I am currently doing Web Monkey's Blog > Tutorial (http://www.webmonkey.com/2010/02/Get_Started_With_Django/) > To date everything has worked but when I try to use the urls from the > blog urls.py I get the following error: > > Using the URLconf defined in anttipetaisto.urls, Django tried these > URL patterns, in this order: > > ^admin/doc/ > ^admin/ > ^blog/ (?Pd{4})/(?P[a-z]{3})/(?Pw{1,2})/(?P[-w] > +)/$ > ^blog/ ^(?Pd{4})/(?P[a-z]{3})/(?Pw{1,2})/(?P[- > w]+)/$ > ^blog/ ^(?Pd{4})/(?P[a-z]{3})/(?Pw{1,2})/$ > ^blog/ ^(?Pd{4})/(?P[a-z]{3})/$ > ^blog/ ^(?Pd{4})/$ > ^blog/ ^$ > ^tags/(?P[a-zA-Z0-9_.-]+)/$ > ^static_files/(?P.*)$ > > The current URL, blog/2011/jan/20/things-learned-finland/, didn't > match any of these. > > What I don't understand why this is saying that isn't a url match. > Shouldn't it match the third one down? > > Thanks > > Antti -- 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.
urls.py and views.generic issue
The problem: I can't seem to get most of my urls that I type in my browser to math a url in my urls.py file. I am currently doing Web Monkey's Blog Tutorial (http://www.webmonkey.com/2010/02/Get_Started_With_Django/) To date everything has worked but when I try to use the urls from the blog urls.py I get the following error: Using the URLconf defined in anttipetaisto.urls, Django tried these URL patterns, in this order: ^admin/doc/ ^admin/ ^blog/ (?Pd{4})/(?P[a-z]{3})/(?Pw{1,2})/(?P[-w] +)/$ ^blog/ ^(?Pd{4})/(?P[a-z]{3})/(?Pw{1,2})/(?P[- w]+)/$ ^blog/ ^(?Pd{4})/(?P[a-z]{3})/(?Pw{1,2})/$ ^blog/ ^(?Pd{4})/(?P[a-z]{3})/$ ^blog/ ^(?Pd{4})/$ ^blog/ ^$ ^tags/(?P[a-zA-Z0-9_.-]+)/$ ^static_files/(?P.*)$ The current URL, blog/2011/jan/20/things-learned-finland/, didn't match any of these. What I don't understand why this is saying that isn't a url match. Shouldn't it match the third one down? Thanks Antti -- 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.
Filtering the filters in Django Admin
Here is my code for a school project http://dpaste.com/434311/ The code works fine, on studentadmin list page, I get filter for classes which is good but as you can see my project is multi-tenant so in filter area I want to show only the classes for the school the current user is logged in (tracked thru sessions) but right now I can see list of all classes from all schools so I want to replace this line list_filter = ['xclass'] with something like list_filter = Class.objects.filter(school=request.session['school_id']) how can I do it ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Using contenttypes without auth
If you use contenttypes without auth in INSTALLED_APPS (eg, being used) it seems the auth models still get installed. When you run syncdb with a state content type, it will prompt to delete the stale CT entry and the Permission model tries to clean up: File "/home/wk/projects/rootproj/django/core/management/commands/ syncdb.py", line 105, in handle_noargs emit_post_sync_signal(created_models, verbosity, interactive, db) File "/home/wk/projects/rootproj/django/core/management/sql.py", line 190, in emit_post_sync_signal interactive=interactive, db=db) File "/home/wk/projects/rootproj/django/dispatch/dispatcher.py", line 172, in send response = receiver(signal=self, sender=sender, **named) File "/home/wk/projects/rootproj/django/contrib/contenttypes/ management.py", line 48, in update_contenttypes ct.delete() File "/home/wk/projects/rootproj/django/db/models/base.py", line 578, in delete collector.collect([self]) File "/home/wk/projects/rootproj/django/db/models/deletion.py", line 143, in collect if not sub_objs: File "/home/wk/projects/rootproj/django/db/models/query.py", line 113, in __nonzero__ iter(self).next() File "/home/wk/projects/rootproj/django/db/models/query.py", line 107, in _result_iter self._fill_cache() File "/home/wk/projects/rootproj/django/db/models/query.py", line 766, in _fill_cache self._result_cache.append(self._iter.next()) File "/home/wk/projects/rootproj/django/db/models/query.py", line 273, in iterator for row in compiler.results_iter(): File "/home/wk/projects/rootproj/django/db/models/sql/compiler.py", line 680, in results_iter for rows in self.execute_sql(MULTI): File "/home/wk/projects/rootproj/django/db/models/sql/compiler.py", line 735, in execute_sql cursor.execute(sql, params) File "/home/wk/projects/rootproj/django/db/backends/util.py", line 18, in execute return self.cursor.execute(sql, params) File "/home/wk/projects/rootproj/django/db/backends/ postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args) django.db.utils.DatabaseError: relation "auth_permission" does not exist LINE 1: ...ntent_type_id", "auth_permission"."codename" FROM "auth_perm... What's odd is that the tables correctly never get installed. Is contenttypes not available for projects not using auth? -- 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: Messages framework is not showing messages in my templates
Thanks Daniel, is just this, I forgget the context_processor on my return... thanks for all. G. On 18 Feb, 19:38, Daniel Roseman wrote: > On Friday, February 18, 2011 10:56:54 AM UTC, Gabriel Prat wrote: > > > Hi all, I'm trying to use messages framework, I've checked that > > middleware, context processor and app is well configured (I'm running > > django development version which a standard manage.py startproject > > includes all needed stuff) > > > So, let me write a little bit of code, assume a model like: > > > class MyModel(models.Model): > > name = models.TextField(max_length = 100) > > url = models.URLField() > > > And a simple form: > > > class mymodelForm(forms.ModelForm): > > name = forms.CharField() > > url = forms.URLField() > > class Meta: > > model = MyModel > > > A basic view (assuming all needed imports in top of my views.py file): > > > def mymodel_create(request): > > from forms import mymodelForm > > if request.method == 'POST': > > form = mymodelForm(request.POST) > > if form.is_valid(): > > form.save() > > messages.success(request, _('Model has been saved')) > > else: > > form = projectForm() > > > return render_to_response('mymodel_create.html', {'form' : form}) > > > > > The context processor is not invoked, because you're not using a > RequestContext. So the messages variable is not added to your context. The > last line should be: > > return render_to_response('mymodel_create.html', {'form' : form}, > context_instance=RequestContext) > > See the documentation: > http://docs.djangoproject.com/en/1.2/ref/templates/api/#subclassing-c... > (the Note box, a couple of screens down - unfortunately there's no handy id > to link to directly) > -- > 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: show a visual map of relationship between models
Perfect! that's excactly what I need. thanks a lot Bedros On Feb 19, 11:01 am, Thomas Rega wrote: > 2011/2/19 bedros <2bed...@gmail.com>: > > > Hi all, > > > Any one knows of a django app that shows the map of relationship > > between models in my django ORM; I remember seeing something like that > > in the past, but I forgot where. > > http://code.djangoproject.com/wiki/DjangoGraphviz > > good luck, > TR -- 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: show a visual map of relationship between models
2011/2/19 bedros <2bed...@gmail.com>: > Hi all, > > Any one knows of a django app that shows the map of relationship > between models in my django ORM; I remember seeing something like that > in the past, but I forgot where. http://code.djangoproject.com/wiki/DjangoGraphviz good luck, TR -- 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.
show a visual map of relationship between models
Hi all, Any one knows of a django app that shows the map of relationship between models in my django ORM; I remember seeing something like that in the past, but I forgot where. Thanks, Bedros -- 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 administration - Allow full HTML for a TextField form
Thanks for the 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: Constant signing out on production server - Django 1.2.5
Okay, it sounds like your problem is different. Mine only happened in IE, and not to all users, and not the same IE version. Just to some specific users, 100% of the time. -- 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: Problem in new Django Project- cannot import tables.
On Saturday, February 19, 2011 10:52:50 AM UTC, Rohini Dhavale wrote: > > As per the tutorials I am trying to create my own project. Followed > every step up to creating database; syncdb. But in interactive shell > when trying out ' from student_cce.models import abhivyakti ' command > where student_cce is name of my project model and abhivyakti is name > of my databse table it is giving me error : ' ImportError: cannot > import name abhivyakti ' where I have already defined abhivyakti as > model in settings.py. Please give me the solution. This is a basic Python question. When using import, you need to give the fully-qualified module that you are importing. As you can see from your own directory structure, you have a directory called 'abhivyakti', which is the application, and inside that is a file called 'models.py', which contains the actual model names (which you haven't given). So either do `from abhivyakti import models` - and now you can reference your model classes via `models.MyModelName` - or `from abhivyakti.models import MyModelName`, and just refer to MyModelName. -- 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 administration - Allow full HTML for a TextField form
On Saturday, February 19, 2011 3:04:27 PM UTC, NewNumOrder wrote: > > I've tried enabling 'allow_tags' for a TextField, but the admin tools > still encode the text when inserting or updating rows. > > Is the following code correct? > some_field = models.TextField() > some_field.allow_tags = True > > I can't even edit the HTML with phpPgAdmin because it does the same > thing, so I'm forced to use pure SQL. Imagine updating a field with > 5000+ char HTML with SQL ;) > > I hope somebody here knows a way to edit HTML from a DB more > conveniently... Even if it's not Django-based. > No, allow_tags has nothing to do with textfields. Django doesn't encode text when saving data from a textfield. It does encode - actually, escape - the text when it is *output*, which you can avoid by marking it as safe with the `safe` template filter. But nothing will be changed on the way in. -- 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 administration - Allow full HTML for a TextField form
I've tried enabling 'allow_tags' for a TextField, but the admin tools still encode the text when inserting or updating rows. Is the following code correct? some_field = models.TextField() some_field.allow_tags = True I can't even edit the HTML with phpPgAdmin because it does the same thing, so I'm forced to use pure SQL. Imagine updating a field with 5000+ char HTML with SQL ;) I hope somebody here knows a way to edit HTML from a DB more conveniently... Even if it's not Django-based. -- 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 Aptana Run
Hello, i'm trying to get Django running in Aptana Studio. I've got PyDev installed and can create a new project. The point that's missing is the "run as". Does anybody know how to setup a run configuration. (Im running it on mac, if that's important to know). Or is there a better dev environment to develop for django? Regards Andi -- 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 reinstall Python Interpreters?
Why not just use virtualenv and then just easy_install I'm using it with python 2.5 and it works great. On Feb 18, 8:07 pm, lduros wrote: > Did you install dajaxice through apt-get? From the command line: sudo > apt-get install python-django-dajaxice > If not, you might want to try it it might do the trick of installing > it in a much easier way than from the sources. > > On Feb 18, 5:04 pm, LJ wrote: > > > Just adding a note for anyone else struggling with a similar > > 'unresolved import' problem... > > This article explains in details how to modify the PYTHONPATH if you > > decide to go that route. > > http://www.stereoplex.com/blog/understanding-imports-and-pythonpath > > I don't prefer to use this method, but I now understand how django is > > able to find imported libraries. > > > I am still looking for a good article on how to install/configure a > > 3rd party app in site packages--or dist-packages on Ubuntu (Python > > 2.6). > > > On Feb 18, 12:39 pm, LJ wrote: > > > > I am on Ubuntu 10, using Python 2.6 and Django 1.2.3. > > > Mike Ramirez suggested that I look at the site packages (in my case > > > dist-packages) in my python lib dir. > > > I did not see anything in there that references dajaxice. I may need > > > to manually edit the PYTHONPATH once I figure out how and where. > > > > My errors are: > > > Unresolved import: dajaxice_autodiscover > > > Unresolved import: dajaxice_functions > > > > On Feb 18, 7:17 am, CrabbyPete wrote: > > > > > I wouldn't reinstall python because of an unresolved import error. > > > > What's unresolved and what type of system are you on PC/Linux? > > > > > On Feb 17, 7:48 pm, LJ wrote: > > > > > > I installed the latest version of dajaxice, but I am still getting > > > > > Unresolved import errors. > > > > > My guess is that I need to remove and reinstall the Python > > > > > Interpreters. > > > > > Is there a some documentation somewhere that explains how to reinstall > > > > > the Python Interpreters, so I can resolve all of my Unresolved Import > > > > > 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: Not able to use CSS in Django templates
On Sat, Feb 19, 2011 at 2:58 PM, The_Legend wrote: > I tried a lot, found another post with same some, but without luck :( > > till now --- > > project name --- library--- c:\library\ > > C:\library>dir > > Directory of C:\library > > 02/19/2011 07:29 PM mainapp > 02/19/2011 11:26 AM 557 manage.py > 02/19/2011 08:16 PM media > 02/19/2011 08:19 PM 3,537 settings.py > 02/19/2011 08:19 PM 2,215 settings.pyc > 02/19/2011 07:58 PM templates > 02/19/2011 08:17 PM 832 urls.py > 02/19/2011 08:18 PM 655 urls.pyc > 02/19/2011 11:26 AM 0 __init__.py > 02/19/2011 11:30 AM 120 __init__.pyc > > > in settings.py i added > > MEDIA_ROOT = 'C:/library/media/' > DOCUMENT_ROOT = 'C:/library/media/' > MEDIA_URL = '' > ADMIN_MEDIA_PREFIX = '/amedia/' > > > in my urls.py --- > > (r'^home/$','library.mainapp.views.display'), > (r'^media/(?P.*)$','django.views.static.serve', > { 'document_root' : '/media/'} ), document_root is a file location, not a url location. http://docs.djangoproject.com/en/1.2/howto/static-files/#how-to-do-it Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Permission hooks in class-based views
> > The intention for 1.3 was to get a class-based view framework in place > that could serve as a replacement for the existing function-based > generic views. Since the function-based generics don't have > permissions, neither does the initial iteration of class-based views. That's fair enough. > Once we start the 1.4 cycle, we can take a closer look at suggestions > like adding permission support to CBVs. If this topic is something > that you have a particular interest in, I encourage you to tinker with > the code that is there and see if you can develop a concrete proposal > for this feature; that way, when formal feature discussions start, > you'll be in a good position to drive a discussion. For most cases, using a user-specific queryset would be enough, for example: class BlogPostUpdateView(UpdateView): def get_queryset(self): return self.request.user.blogpost_set.all() Which would restrict the ability to update only one's own blog posts. For more specific requirements, a possible SecureMixin could do a post- lookup check through a has_permission() check. The problem then is how to handle non-permitted cases - probably another hook would be required, with a default behaviour being e.g. redirect to login. -- 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.
Not able to use CSS in Django templates
I tried a lot, found another post with same some, but without luck :( till now --- project name --- library--- c:\library\ C:\library>dir Directory of C:\library 02/19/2011 07:29 PM mainapp 02/19/2011 11:26 AM 557 manage.py 02/19/2011 08:16 PM media 02/19/2011 08:19 PM 3,537 settings.py 02/19/2011 08:19 PM 2,215 settings.pyc 02/19/2011 07:58 PM templates 02/19/2011 08:17 PM 832 urls.py 02/19/2011 08:18 PM 655 urls.pyc 02/19/2011 11:26 AM 0 __init__.py 02/19/2011 11:30 AM 120 __init__.pyc in settings.py i added MEDIA_ROOT = 'C:/library/media/' DOCUMENT_ROOT = 'C:/library/media/' MEDIA_URL = '' ADMIN_MEDIA_PREFIX = '/amedia/' in my urls.py --- (r'^home/$','library.mainapp.views.display'), (r'^media/(?P.*)$','django.views.static.serve', { 'document_root' : '/media/'} ), in my html (used as template in django)--- but still without luck, please need help urgently 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.
Problem in new Django Project- cannot import tables.
As per the tutorials I am trying to create my own project. Followed every step up to creating database; syncdb. But in interactive shell when trying out ' from student_cce.models import abhivyakti ' command where student_cce is name of my project model and abhivyakti is name of my databse table it is giving me error : ' ImportError: cannot import name abhivyakti ' where I have already defined abhivyakti as model in settings.py. Please give me the 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.
django-taggit how to get tags based on foreign key
I have a model [http://pastie.org/1582079] which I am trying to get tags based on the Worksheet foreign key, so tags per worksheet. I am unable to find any examples of ways how to do this? I was able to accomplish this easily with django-tagging by doing Tag.objects.usage_for_queryset(Cashflow.objects.filter(worksheet=1).order_by('- date'), counts=True). How do i accomplish this in django-taggit? -- 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 going to point this out ...
It would be interesting to perhaps extend something like django-lint to pick up on what could be mistakes in templates. -- 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.
TinyMCE + Filebrowser (can't make integration)
Help me anyone. I installed separately: 1) grappelli, filebrowser, tinymce. Filebrowser works good, tinymce works good but if I try to get widget of filebrowser from tinymce form (insert image) then I get standart upload interface from tinymce. I want to get my filebrowser interface. In my app folder I made admin.py file: from django.contrib import admin class MyModelAdmin(admin.ModelAdmin): class Media: js = ['/static/tiny_mce/tiny_mce.js', '/static/filebrowser/js/ TinyMCEAdmin.js',] admin.site.register(MyModelAdmin) I can't find manual where I would take right advises for such integration. Please, help me with settings. Best regards, George -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: Broken link emails
I realised the second question is answered here: http://docs.webfaction.com/software/django/troubleshooting.html#accessing-remote-addr which is a middleware that was removed a while back. The first bit of my question still stands though! -- 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: Constant signing out on production server - Django 1.2.5
Shawn I'm glad I'm not alone, but this seems to be a different issue. The client gets the same issue in ANY browser, which makes the problem either more mind-boggling or much easier to solve if the problem is me and I'm missing something major :) Velian On Feb 18, 10:17 pm, Shawn Milochik wrote: > By chance, is the client running Windows and using IE? If so, is their > system time incorrect? > > I've had major problems with session timeouts myself, and ended up > handling session expiration in custom middleware because I never could > figure it out, and over a period of months this list was no help > either. I figured it was some kind of fluke -- I mean, Django's > sessions are being used by plenty of other people with no problems. > But some time after that, someone with a problem that sounded very > similar to mine mentioned that his problem appeared to be due to the > way IE's cookies interacted with the system time. > > Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: Permission hooks in class-based views
On Sat, Feb 19, 2011 at 6:28 PM, fordprefect wrote: > Hi, looking at the new class-based views for 1.3, there doesn't appear > to be an easy way to add row-level permission hooks to the views (as > one can do in ModelAdmin). It seems a strange omission as this should > be quite straightforward and is an extremely common use-case. > > For example, if I have a BlogPostEditView I should be able to specify > a has_permission() method, e.g.: > > class BlogPostEditView(UpdateView): > > def has_permission(self, inst): > return request.user.id == inst.author_id > > > Are row-level permissions in the works for class-based views ? The intention for 1.3 was to get a class-based view framework in place that could serve as a replacement for the existing function-based generic views. Since the function-based generics don't have permissions, neither does the initial iteration of class-based views. At this point in the 1.3 cycle, there aren't any new feature plans for class-based views -- we're just making sure that there aren't any glaring bugs in what is already in trunk. Once we start the 1.4 cycle, we can take a closer look at suggestions like adding permission support to CBVs. If this topic is something that you have a particular interest in, I encourage you to tinker with the code that is there and see if you can develop a concrete proposal for this feature; that way, when formal feature discussions start, you'll be in a good position to drive a discussion. 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.
Permission hooks in class-based views
Hi, looking at the new class-based views for 1.3, there doesn't appear to be an easy way to add row-level permission hooks to the views (as one can do in ModelAdmin). It seems a strange omission as this should be quite straightforward and is an extremely common use-case. For example, if I have a BlogPostEditView I should be able to specify a has_permission() method, e.g.: class BlogPostEditView(UpdateView): def has_permission(self, inst): return request.user.id == inst.author_id Are row-level permissions in the works for class-based views ? -- 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.