How can I view in the templates the files that I stored by “models.FilePathField”?

2013-06-25 Thread Federico Erbea
I can't understand how to pass to the template a relative path rather than an absolute. Could you help me please...??! here a class of my models.py : class Brano( models.Model ): titolo = models.CharField( max_length=39 ) testo = models.TextField( max_length=1000 ) locandina = mod

hi [django-users]How to define the response?

2013-06-25 Thread lx
hi : I'm a new one. I want to fix a question.Like this: from django.http import HttpResponse import datetime def current_datetime(request): now = datetime.datetime.now() if now == 2013: html = "It is now %s."

Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread lx
Thank you. But I want to fix it like this, because the time of "do something" is not long. ### from django.http import HttpResponseimport datetimedef current_datetime(request): now = datetime.datetime.now() if now == 2013:

Re: How to have two unicode methods in the models?

2013-06-25 Thread Christophe Pettus
On Jun 25, 2013, at 6:54 PM, yeswanth nadella wrote: > How do I add another unicode method so that it will return only first_name > and last_name? You can have as many methods in a model class as you wish, of course, but you can only have one __unicode__, since that's what handles unicode() an

Re: How can I have two unicode methods?

2013-06-25 Thread Sithembewena Lloyd Dube
I have previously achieved this by using an if statement as follows: if : return else: return What is your specific requirement, i.e. why do you need to implement this? On Wed, Jun 26, 2013 at 3:47 AM, yeswanth nadella wrote: > In my models file, I have the following unicode method-

How to have two unicode methods in the models?

2013-06-25 Thread yeswanth nadella
This is what I currently have- def __unicode__(self): return u'%s %s %s %s %s %s' % (self.first_name, self.last_name, self.course, self.lab, self.start_time, self.end_time) How do I add another unicode method so that it will return only first_name and last_name? I understand that unicode method

How can I have two unicode methods?

2013-06-25 Thread yeswanth nadella
In my models file, I have the following unicode method- def __unicode__(self): return u'%s %s %s %s %s %s' % (self.first_name, self.last_name, self.course, self.lab, self.start_time, self.end_time) How can I have another unicode method which will return only first_name and last_name? I understa

Re: Set up django-celery with mod_wsgi

2013-06-25 Thread no body
I am trying to use *echo_supervisord_conf > schedule.conf * then add the schedule.conf witth *[program:celeryd] command=python /opt/a/wwwroot/b/abc/manage.py celerybeat * and runt this command. Not sure whether this will work. Have to wait a bit now *supervisord -c schedule.conf* On Tue, J

Set up django-celery with mod_wsgi

2013-06-25 Thread no body
I have set up the django-celery in my local machine as the following * * *#settings.py import djcelery djcelery.setup_loader() BROKER_TRANSPORT = "django" CELERY_ALWAYS_EAGER = True CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"* In order to let the user set/modify the periodic ta

Re: Multi-DB read replica unit test raises TransactionManagementError

2013-06-25 Thread Michael
Bump! I'm experiencing the same issue. On Friday, 3 May 2013 23:19:26 UTC+1, TTimo wrote: > > Hello, > > I started assessing multi-db support in Django 1.5.1, I'm interested in > having read replicas and a write master. > > I've figured out all the easy stuff: using TEST_MIRROR in the DATABASES

Re: Select2Multiple with list_filter :(

2013-06-25 Thread carlos
Hi maybe help you try this snippets http://djangosnippets.org/snippets/1758/ Cheers On Tue, Jun 25, 2013 at 6:21 AM, Jesús Lucas Flores wrote: > Hi i am looking for a thirth package for a usual funcinality : I want > filter for multiple values with list_filter for django admin but I can't . > (

Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread Hector Armando Vela Santos
You can use Celery for that, I've done something similar, just with a CSV instead of a XML, check this http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html once installed and configured, its as simple as: from celery import task if (the xml format is ERROR) == True:

Re: Writing your first Django app - Tutorial Question

2013-06-25 Thread Tony Guilin
> > you have missed > from django.utils import timezone > That worked! Thanks. P.S. I just copy and paste in Chrome (in Ubuntu) and it picks up the formatting. On Tuesday, June 4, 2013 4:10:23 PM UTC-7, Tony Guilin wrote: > > In the https://docs.djangoproject.com/en/1.5/intro/tutorial01

Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread Sandro Dutra
If the "do_something" will take a long time to finish, you've 2 options: Find a better (optimized) way to "do_something" or inform your client the application is doing something and he will have to wait a little. So, I can't see any advantage to say to your client there's something was ok if the a

Re: Hi..how to create seperate label next to sign up button in login page and direct user to new page using django?

2013-06-25 Thread Sergiy Khohlov
add url to your code (at login page) and and this url to url.py Dont forget to pass tutorials Many thanks, Serge +380 636150445 skype: skhohlov On Tue, Jun 25, 2013 at 4:19 PM, Viji Venkatesan wrote: > > -- > You received this message because you are subscribed to the Google Groups

Re: File Path Question

2013-06-25 Thread Bill Freeman
Try using single forward slashes in MEDIA_ROOT (and in other paths in settings.py). On Sat, Jun 22, 2013 at 3:46 AM, Nigel Legg wrote: > MEDIA_ROOT = 'c:\\stats_portal\\myproject\\myproject\\media\\' > > doesn't work. I've parsed the path to get this working for the time > being, thanks for yo

Hi..how to create seperate label next to sign up button in login page and direct user to new page using django?

2013-06-25 Thread Viji Venkatesan
-- 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. V

Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread lx
Thank you. The real demand is: 1. receive the xml file from client. 2. if (the xml format is ERROR) == True: return HttpResponse(ERROR FORMAT") else: return HttpResponse(RIGHT FORMAT") #I must give a response first, And do other thing. Because the spend time of do_something() may be

Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread Sandro Dutra
The question is: What you're trying to do? 1. You can do any other process before the return line, the return will be the same... for example: from django.http import HttpResponse from datetime import datetime def current_datetime(request): now = datetime.now() html = "It is n

Re: Missing Related Objects in MODEL._meta.get_all_related_objects

2013-06-25 Thread Emil Stenström
On Thursday, 17 February 2011 17:09:26 UTC+1, Martin Siniawski wrote: > > Hey! > > So we have a certain model which is related with many other models, by > ForeignKey fields set in those other models. > > The setup is not particularly exotic, but for some reason, when > using ._meta.get_all_rel

Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread Timster
You cannot do something after the "return" line. This is Python functionality. When you return, the function exits and does not process anything else. What exactly are you trying to do? There is probably another way to accomplish it. -- You received this message because you are subscribed to

Select2Multiple with list_filter :(

2013-06-25 Thread Jesús Lucas Flores
Hi i am looking for a thirth package for a usual funcinality : I want filter for multiple values with list_filter for django admin but I can't . ( I search for something like Select2Multiple ) anybody can help me? Thank you! *Sorry about my english -- You received this message because you are

django templates

2013-06-25 Thread Harjot Mann
I have created a table in django templates but I want that the fields which are not filled from form should not be display in table not even the border and header of that field also. The headers are static while the data is coming from database. I used if and for loop for this but whenever I am

Re: Background pattern files on S3 not being found while hosted on Heroku

2013-06-25 Thread Vincent Fulco
retried #3 without quotes and link works now. -- 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, s

Django Debug Toolbar inside Webkit DevTools

2013-06-25 Thread recamshak
I like Django Debug Toolbar, it's much more pleasant than looking at logs to quickly find out SQL requests that were executed to render a page. But I was frustrated not being able to use it on AJAX requests. So I started a chrome DevTools extension

Re: delete file in GridFS by its id

2013-06-25 Thread Tom Christie
Hi Hélio, I see that you've posted this question separately on each of the `django users`, `mongoengine users`, and `mongoengine developers`. Please don't cross post questions on mailing lists - pick one appropriate mailing list and use that. If you cross post questions there's every cha

hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread lx
hi all: I want to do someing after "return HttpResponse(html)". for example "" from django.http import HttpResponse import datetime def current_datetime(request): now = datetime.datetime.now() html = "It is now %s." % now return HttpResponse(html) """

delete file in GridFS by its id

2013-06-25 Thread Hélio Miranda
Hi I have a problem that is how to delete a file from GridFS by its id. I am using django and mongoengine. To delete files of a certain record I'm doing this: *marmot = Animal.objects.get(id='51c80fb28774a715dc0481ae')* *marmot.photo.delete()* Now just to delete a file by its id, was trying like

Re: TEMPLATE_CONTEXT_PROCESSORS missing in settings.py

2013-06-25 Thread Some Developer
On 22/06/2013 02:24, asax...@princeton.edu wrote: # Make this unique, and don't share it with anybody. SECRET_KEY = '8c(j)m3dm!m3gd_n#vjjfqdeuq!ltsj3+xii617dos1i@_pc7*' You'll want to change your secret key now that you have posted it on a public mailing list if you are actual