One to many issue in Django admin
I have an album and it has many tracks. The track has a FileField. The FileField has null=True and blank=True. In Django admin I can add a track without specifying a file without a problem however if I go into album and try to add a track that way. It has an error saying that the file can not be null. Has anyone else had this issue? Stack Trace: http://dpaste.com/31198/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ImageFile not prepending MEDIA_ROOT onto upload_to folder location
For some reason when I upload files, they are getting put straight into my c:/ root rather than the MEDIA_ROOT specified in the setting.py. ie. If I have this in my model: image = models.ImageField(upload_to="/albums",blank=True, null=True) it will create a directory c:\albums and upload the files to this directory. The documentation says that the media root will be added on the front. I could just do it manually but I want to know if it is a problem with the code or something I am doing wrong. If it hasn't become apparent, I am using windows. Any ideas are appreciated =] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Replace function within template?
Is it possible to perform a replace operation in a template? I couldn't find any reference to it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django multitenant urls configuration
Hello everrybody! I am trying to add some simple tenancy support to an app, creating an Account model which has a string 'tenant' to be read from the request url and identify the tenant in the system: tenant.example.com/* -> www.example.com/tenant/* (rewritten by apache) I wrote a simple middleware to capture this /tenant/ from request.path and add a request.account object to be worked with. My problem is my url mapping. I tried this: url(r'^(?P[\w\-]+)/', include('project.urls_tenant')), and defined some simple urls inside urls_tenant.py: url(r'^app1/', include('project.app1.urls')), url(r'^app2/', include('project.app2.urls')), When I try to access any page, I get an error message: generic_view_method() got an unexpected keyword argument 'tenant_id' because it doesn't (and really shouldn't) expect tenant_id as a parameter. If I hardcode tenant_id in the urls.py file as /test_tenant/ everything works fine. What am I doing wrong and how to fix it, so the request and the response gets processed normally? Thank you guys pretty much. I used this as reference: optimal architecture for multitenant application on django: http://stackoverflow.com/questions/7194341/optimal-architecture-for-multitenant-application-on-django -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/_qhdKzTLnQcJ. 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: One to many issue in Django admin
If that is the case then how can I possibly add a track with no file selected at all? i.e. I can add a track through the track interface in django admin but not through the parent record interface (Album) ... If what you are saying were correct then it shouldn't allow me to add a track without a file under any circumstances... right? -Original Message- From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of James Bennett Sent: Wednesday, 16 January 2008 2:20 PM To: django-users@googlegroups.com Subject: Re: One to many issue in Django admin On Jan 15, 2008 9:34 PM, oak <[EMAIL PROTECTED]> wrote: > In Django admin I can add a track without specifying a file without a > problem however if I go into album and try to add a track that way. It > has an error saying that the file can not be null. It looks like you initially created the table without having the 'null=True' option specified; if you go back and add that later, Django does not alter the underlying database table for you, so you'll need to execute the necessary SQL to drop the NOT NULL constraint from the column. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." Disclaimer: Please note that during Western Australian daylight savings time RWWA appointment times and email send times are based on GMT+9. If in doubt, we recommend you confirm appointment times. 1. The contents of this email and its attachments are confidential and privileged. Any unauthorised use, or passing on, of the information to others who are not authorised is expressly prohibited. If you receive this email in error, please advise us and then delete the email with any attachments. 2. Before opening or using attachments, check them for viruses and defects. The contents of this email and its attachments may become scrambled, truncated or altered in transmission. Please advise us of any anomalies. 3. Racing & Wagering WA's liability is limited to resupplying the email and attached files or the cost of having them resupplied. 4. The views represented in this email are those of the author and do not necessarily represent those of Racing & Wagering WA unless this is clearly indicated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
RE: Replace function within template?
... lol. I'm pretty sure you know what I mean now but I'll clarify it anyway: When I say "in a template" I mean "within the code in a Django template" (Not within a text editor). As far as I know this is limited to a set of Django specific commands. I have a string variable and I want to replace all the instances of a specific string within this variable with another specific string. I know I could do the operation in the view but it's such a simple thing that it doesn't make sense to me to do it that way. I hope that is more clear =] -Original Message- From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Russell Keith-Magee Sent: Tuesday, 22 January 2008 12:39 PM To: django-users@googlegroups.com Subject: Re: Replace function within template? On Jan 22, 2008 11:18 AM, oak <[EMAIL PROTECTED]> wrote: > > Is it possible to perform a replace operation in a template? I > couldn't find any reference to it. My text editor has a magnificent Replace operation. It can replace any text with any other text. It even allows you to use regular expressions to specify the text you want to replace. Oh - that wasn't what you meant? You know, when you're asking someone for help, it sometimes helps to elaborate a little on the problem you're having. "Replace operation" is a fairly ambiguous term. If you can't find a reference to "Replace" in the documentation, it might be because we use a different term to describe the feature, or it could be because Django encourages you to look at the problem in a different way ... unless we know what it is you are trying to do, nobody is going to be able to help. So - care to tell us what it is you want to do? Yours, Russ Magee %-) Disclaimer: Please note that during Western Australian daylight savings time RWWA appointment times and email send times are based on GMT+9. If in doubt, we recommend you confirm appointment times. 1. The contents of this email and its attachments are confidential and privileged. Any unauthorised use, or passing on, of the information to others who are not authorised is expressly prohibited. If you receive this email in error, please advise us and then delete the email with any attachments. 2. Before opening or using attachments, check them for viruses and defects. The contents of this email and its attachments may become scrambled, truncated or altered in transmission. Please advise us of any anomalies. 3. Racing & Wagering WA's liability is limited to resupplying the email and attached files or the cost of having them resupplied. 4. The views represented in this email are those of the author and do not necessarily represent those of Racing & Wagering WA unless this is clearly indicated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
RE: Replace function within template?
Thanks for the help Alex =] I knew that I could write my own but I thought it would be quicker to check if someone had done it already because it seems like something that would be pretty common. -Original Message- From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, 22 January 2008 2:17 PM To: Django users Subject: Re: Replace function within template? This would be something to use a template filter for, you can either use one of the built in ones: http://www.djangoproject.com/documentation/templates/#built-in-filter-re ference if it exists, or you could write your own. On Jan 21, 10:44 pm, "Oak McIlwain" <[EMAIL PROTECTED]> wrote: > ... lol. > > I'm pretty sure you know what I mean now but I'll clarify it anyway: > > When I say "in a template" I mean "within the code in a Django template" > (Not within a text editor). As far as I know this is limited to a set of > Django specific commands. > > I have a string variable and I want to replace all the instances of a > specific string within this variable with another specific string. > > I know I could do the operation in the view but it's such a simple thing > that it doesn't make sense to me to do it that way. > > I hope that is more clear =] > > -Original Message- > From: django-users@googlegroups.com > > [mailto:[EMAIL PROTECTED] On Behalf Of Russell Keith-Magee > Sent: Tuesday, 22 January 2008 12:39 PM > To: django-users@googlegroups.com > Subject: Re: Replace function within template? > > On Jan 22, 2008 11:18 AM, oak <[EMAIL PROTECTED]> wrote: > > > Is it possible to perform a replace operation in a template? I > > couldn't find any reference to it. > > My text editor has a magnificent Replace operation. It can replace any > text with any other text. It even allows you to use regular > expressions to specify the text you want to replace. > > Oh - that wasn't what you meant? > > You know, when you're asking someone for help, it sometimes helps to > elaborate a little on the problem you're having. "Replace operation" > is a fairly ambiguous term. If you can't find a reference to "Replace" > in the documentation, it might be because we use a different term to > describe the feature, or it could be because Django encourages you to > look at the problem in a different way ... unless we know what it is > you are trying to do, nobody is going to be able to help. > > So - care to tell us what it is you want to do? > > Yours, > Russ Magee %-) > > Disclaimer: > Please note that during Western Australian daylight savings time RWWA appointment times and email send times are based on GMT+9. > If in doubt, we recommend you confirm appointment times. > > 1. The contents of this email and its attachments are confidential and privileged. Any unauthorised use, or passing on, of the information to others who are not authorised is expressly prohibited. If you receive this email in error, please advise us and then delete the email with any attachments. > > 2. Before opening or using attachments, check them for viruses and defects. The contents of this email and its attachments may become scrambled, truncated or altered in transmission. Please advise us of any anomalies. > > 3. Racing & Wagering WA's liability is limited to resupplying the email and attached files or the cost of having them resupplied. > > 4. The views represented in this email are those of the author and do not necessarily represent those of Racing & Wagering WA unless this is clearly indicated. Disclaimer: Please note that during Western Australian daylight savings time RWWA appointment times and email send times are based on GMT+9. If in doubt, we recommend you confirm appointment times. 1. The contents of this email and its attachments are confidential and privileged. Any unauthorised use, or passing on, of the information to others who are not authorised is expressly prohibited. If you receive this email in error, please advise us and then delete the email with any attachments. 2. Before opening or using attachments, check them for viruses and defects. The contents of this email and its attachments may become scrambled, truncated or altered in transmission. Please advise us of any anomalies. 3. Racing & Wagering WA's liability is limited to resupplying the email and attached files or the cost of having them resupplied. 4. The views represented in this email are those of the author and do not necessarily represent those of Racing & Wagering WA unless this is clearly indicated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: interplay between django and twitter-bootstrap...
Hello Pankaj, This is much of a help from you. Thank you very much for you help. Regards, - sameer oak. On Wed, Jan 23, 2013 at 7:07 PM, Pankaj Singh wrote: > Hey Sameer, > > Django gives you complete freedom for choosing client side libraries. > You can easily use twitter-bootstrap in django templates. There are > many libraries written using django and bootstrap to create beautiful > forms. Here are some example - > > 1. http://django-crispy-forms.readthedocs.org/en/d-0/ > 2. https://github.com/pinax/django-forms-bootstrap > 3. https://github.com/brutasse/django-floppyforms > 4. https://github.com/earle/django-bootstrap > 5. https://github.com/dyve/django-bootstrap-toolkit > > For getting started with bootstrap and django, > 1. Download twitter-bootstrap from official website > 2. Create a new django project > 3. Copy your html files in templates folder > 4. Copy javascript files, css files and images in static folder > 5. Try to get a static template up using TemplateView. > 6. Now you can customize your templates further and use features of > django templates and views to make things more dynamic > > This will give you basic understanding of `how to integrate > django+bootstrap". > > -- > Pankaj Singh > http://about.me/psjinx > > > On Wed, Jan 23, 2013 at 9:53 AM, SameerOak wrote: > > Hello, > > > > I am new to web development and python and django was my immediate > choice to > > start with. I am in a process of developing a moderated traffic portal. > > Coming straight to the query, can I design my web pages using > > twitter-bootstrap and django framework in the back-end? > > > > Kindly help. > > > > Regards, > > - sameer oak. > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/django-users/-/WypNp46wXB0J. > > 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. > > -- > 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. > > -- 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: johnny.backends.memcached.MemcachedCache': 'module' object has no attribute 'CacheClass' ?????
Did you end up solving this issue? On Sunday, November 10, 2013 2:53:26 AM UTC+8, vittorio wrote: > > In my settings.py I have the following code: > . > CACHES = { > 'default': { > 'BACKEND': 'johnny.backends.memcached.MemcachedCache', > #'BACKEND': 'johnny.backends.memcached.CacheClass', > 'LOCATION': ['127.0.0.1:11212'], > 'JOHNNY_CACHE': True, > } > } > > JOHNNY_MIDDLEWARE_KEY_PREFIX='vic_' > > MIDDLEWARE_CLASSES = ( > 'johnny.middleware.LocalStoreClearMiddleware', > 'johnny.middleware.QueryCacheMiddleware', > . > > Which worked like a charm till django 1.5.5. > > Now, after installing the new django 1.6 when I launch 'python manage.py > runserver' the following fatal error is signalled: > > > File > "/Library/Python/2.7/site-packages/django/contrib/staticfiles/management/commands/runserver.py", > > line 6, in > from django.contrib.staticfiles.handlers import StaticFilesHandler > File > "/Library/Python/2.7/site-packages/django/contrib/staticfiles/handlers.py", > line 8, in > from django.contrib.staticfiles.views import serve > File > "/Library/Python/2.7/site-packages/django/contrib/staticfiles/views.py", > line 15, in > from django.contrib.staticfiles import finders > File > "/Library/Python/2.7/site-packages/django/contrib/staticfiles/finders.py", > line 12, in > from django.contrib.staticfiles.storage import AppStaticStorage > File > "/Library/Python/2.7/site-packages/django/contrib/staticfiles/storage.py", > line 8, in > from django.core.cache import (get_cache, InvalidCacheBackendError, > File "/Library/Python/2.7/site-packages/django/core/cache/__init__.py", > line 138, in > cache = get_cache(DEFAULT_CACHE_ALIAS) > File "/Library/Python/2.7/site-packages/django/core/cache/__init__.py", > line 130, in get_cache > "Could not find backend '%s': %s" % (backend, e)) > django.core.cache.backends.base.InvalidCacheBackendError: Could not find > backend 'johnny.backends.memcached.MemcachedCache': 'module' object has no > attribute 'CacheClass' > > Surfing the netI found a workaround for this error that applied to django > 1.4 butturned out to be useless with 1.6. > Please help > Vittorio > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/663368a5-005a-4a58-a582-6d46afc75d41%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.