Re: Using another database while testing

2012-02-01 Thread Denis Darii
You can redefine your database connection by adding somewhere at the end of
your settings.py something like:

import sys
if 'test' in sys.argv:
DATABASES = ...

hope this helps.

On Wed, Feb 1, 2012 at 6:01 PM, xina towner  wrote:

> I have a problem, django can't create my database because a dependency, I
> create it manually with a script, is there any way I can specify to the
> testing tool to use my database?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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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 with localization

2012-02-04 Thread Denis Darii
Vittorino, this is not related to your initial question and you must
consider that the format() returns always a string. And why do you use
format() in total_no_vat()?

I would separate the "total":

...
 def total_no_vat(self):
return self.total_income + self.total_fee

 def total(self):
 return self.total_no_vat() * 1.21

 def formatted_total(self):
 return format(self.total(), settings.DECIMAL_SEPARATOR, 2)

now you can use formatted_total in your list_display
Denis.


On Sat, Feb 4, 2012 at 2:40 PM, Vittorino Parenti <
vpare...@thundersystems.it> wrote:

> Hi,
> I think this is not the solution.
> I do another example:
>
> MODEL
> 
> class Procedure(models.Model):
>  
>  total_income = models.DecimalField (
>default = 0,
>max_digits = 11,
>decimal_places = 4,
>verbose_name = _("Total Income"),
>  )
>  total_fee = models.DecimalField (
>default = 0,
>max_digits = 11,
>decimal_places = 4,
>verbose_name = _("Total Fee"),
>  )
>  
>   def total_no_vat(self):
> total_no_vat -no= self.total_income + self.total_fee
> return format(total_no_vat, settings.DECIMAL_SEPARATOR, 2)
>
>  def total(self):
>  total = self.total_no_vat() * 1.21
>  return format(total, settings.DECIMAL_SEPARATOR, 2)
>
> type of self.total_no_vat is unicode and I cannot do other operations
> on this field.
> Thanks,
> Vittorino
>
>
> On 4 Feb, 10:15, Denis Darii  wrote:
> > Hi Vittorino, this is happen because the model fields are automatically
> > formatted by django considering your settings.DECIMAL_SEPARATOR, but in
> > your total() you're simply return the sum of two Decimal()
> >
> > To solve this you can import format and pass the result of total() to it
> > like:
> >
> > from django.conf import settings
> > from django.utils.numberformat import format
> > ...
> >  def total(self):
> > total = self.total_income + self.total_fee
> > return format(total, settings.DECIMAL_SEPARATOR, 2)
> >
> > hope it helps! Have a nice weekend!
> > Denis.
> >
> > On Sat, Feb 4, 2012 at 9:52 AM, Vittorino Parenti <
> >
> >
> >
> >
> >
> >
> >
> > vpare...@thundersystems.it> wrote:
> > > Hello,
> > > i've a problem with number format localization. This is an example of
> > > my model and admin:
> >
> > > MODEL
> > > 
> > > class Procedure(models.Model):
> > >  
> > >  total_income = models.DecimalField (
> > >default = 0,
> > >max_digits = 11,
> > >decimal_places = 4,
> > >verbose_name = _("Total Income"),
> > >  )
> > >  total_fee = models.DecimalField (
> > >default = 0,
> > >max_digits = 11,
> > >decimal_places = 4,
> > >verbose_name = _("Total Fee"),
> > >  )
> > >  
> > >  def total(self):
> > > return self.total_income + self.total_fee
> >
> > > ADMIN
> > > ---
> > > class ProcedureAdmin(dmin.ModelAdmin):
> > >  list_display = (..., 'total_income', 'total_fee', 'total', ...)
> >
> > > output is:
> >
> > > ... | 35,22 | 9,28 | 45.50 | ...
> >
> > > with comma in first two cases and dot then.
> > > How can I do?
> > > Thanks in advance,
> > > Vittorino
> >
> > > --
> > > 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.
>
>

-- 
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: rich text editing

2012-02-04 Thread Denis Darii
Take a look at this app: https://github.com/pydanny/django-wysiwyg

On Sat, Feb 4, 2012 at 2:44 PM, yonatan braude wrote:

> I want to enable rich text editing to editor on the site. what is the best
> way?
> thanx
> yonatan
>
> --
> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: Is there a simple way to write the site root as a variable clientside

2012-02-04 Thread Denis Darii
I'm not sure I fully understand your questions, but I think you need to
know more about the stupend "sites" framework:
https://docs.djangoproject.com/en/dev/ref/contrib/sites/

On Sat, Feb 4, 2012 at 5:13 PM, Jason <1jason.whatf...@gmail.com> wrote:

> Hi there,
>
> Is there a simple way to write the site root as a variable clientside?
> i.e. if I'm running locally the site root var with appear clientside as
> http://localhost:1010 however if I deploy the root will be
> http://www.mysite.com?
>
> Cheers,
> J
>
> --
> 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/-/lDnCch_r3lAJ.
> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: dynamic permissions

2012-02-05 Thread Denis Darii
It seems that you are looking for a "per object permissions" system, so
take a look at django-guardian: https://github.com/lukaszb/django-guardian

On Sun, Feb 5, 2012 at 3:59 PM, Vittorino Parenti <
vpare...@thundersystems.it> wrote:

> i've a model with document'categories and a model with documents. i
> want set permissions per categories: add invoices, download invoices
> and so on (invoice is an example of category).
> Thanks,
> Vittorino
>
>
> On 5 Feb, 12:21, kenneth gonsalves  wrote:
> > On Sun, 2012-02-05 at 03:02 -0800, Vittorino Parenti wrote:
> > > I would like to create dynamic downloading permissions:
> > > - can download invoices
> > > - can upload invoices
> > > - can download contracts
> >
> > what is dynamic about this?
> > --
> > regards
> > Kenneth Gonsalves
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: Making login Testing

2012-02-06 Thread Denis Darii
Yes Rubén you are right,
also you can use directly self.client.login() method:

...

def setUp(self):login =
self.client.login(username='myusername', password='mypass')
self.assertTrue(login)


On Mon, Feb 6, 2012 at 12:46 PM, xina towner  wrote:

> Hi, I've a question, how can I make login while testing? shouldn't be
> enough to do something like this:
>
> def setUp(self):
> response = self.post('/accounts/login/', {'username': 'username',
> 'password': 'username'})
> self.assertEqual(response.status_code, 200, "Login Failure")
> pass
>
> I understand that this setUp makes login before every test. Can you tell
> me if I am right?
>
> --
> Gràcies,
>
> Rubén
>
>  --
> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: Is there a way to prevent /static directory browsing?

2012-02-06 Thread Denis Darii
Under nginx you can set "autoindex" to "off" for "/static/" location:

location /static/
{
autoindex off;
root /path/to/your/static/;
}

More info here: http://wiki.nginx.org/HttpAutoindexModule

On Mon, Feb 6, 2012 at 3:53 PM, Robert Steckroth
wrote:

> Hey Guys, I am looking for a way to hide my media files from
> direct access. What is the common practice here?
> If one would browse to http://www.example.com/static in one of my Django
> sites there would be
> a list of all the files used therein. Is there a way to hide/prevent this
> url from having a directory tree?
>
> --
> Bust0ut Surgemcgee  ---
> BudTVNetwork.com
> RadioWeedShow.com
> PBDefence.com
> "Bringing entertainment to Unix"
> "Finding the exit without looking"
>
> --
> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: number input format

2012-02-07 Thread Denis Darii
from the django's global_settings:

# Decimal separator symbol
DECIMAL_SEPARATOR = '.'

# Boolean that sets whether to add thousand separator when formatting
numbers
USE_THOUSAND_SEPARATOR = False

# Number of digits that will be together, when spliting them by
# THOUSAND_SEPARATOR. 0 means no grouping, 3 means splitting by thousands...
NUMBER_GROUPING = 0

# Thousand separator symbol
THOUSAND_SEPARATOR = ','

On Tue, Feb 7, 2012 at 11:56 AM, Vittorino Parenti <
vpare...@thundersystems.it> wrote:

> Hi,
> I saw there is this setting DATE_INPUT_FORMATS for date.
> Is there a similar solution for the numbers?
> Thanks,
> Vittorino.
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: Installing Django from GIT/Subversion - package dependency in virtual environment

2012-02-20 Thread Denis Darii
Do you mean django-trunk installation?

If so, I use this in my requirements.txt:

-e svn+http://code.djangoproject.com/svn/django/trunk/#egg=django-trunk

or directly with pip:

$ pip install -e svn+
http://code.djangoproject.com/svn/django/trunk/#egg=django-trunk

Hope it helps.

On Mon, Feb 20, 2012 at 1:36 PM, Mateusz Marzantowicz <
mmarzantow...@gmail.com> wrote:

> Hello,
>
> I'm having a problem with managing Django installation which was done from
> git repository
> (might be svn as well) in clean virtual environment. The problem is that
> when I install some
> other package via pip which has a Django as a dependency, it doesn't find
> my django installation
> and then downloads official release. I really need only one Django
> installation in my virtualenv,
> the one from git :) It is more related to how pip works but does anyone
> has any idea how to do it the right way?
>
>
> Thanks,
> Mateusz Marzantowicz
>
> --
> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: Year dropdown in Django admin

2012-02-20 Thread Denis Darii
I was in the same situation as you and I found this solution...
in your models.py:

import datetime
YEAR_CHOICES = []for r in range(1980,
(datetime.datetime.now().year+1)):YEAR_CHOICES.append((r,r))


so, your field can now use YEAR_CHOICES:

year = models.IntegerField(_('year'), max_length=4,
choices=YEAR_CHOICES, default=datetime.datetime.now().year)



On Mon, Feb 20, 2012 at 3:47 PM, grimmus  wrote:

> Hi,
>
> I have a car model that contains many fields including a 'year' field. I
> need the dropdown for this field to display the current year as the first
> option and also display the previous 25 years as individual options.
>
> I was thinking i could create a list object and then populate the list
> based on the current year and work my way back to 25 years earlier.
>
> I am not sure how to implement this so it would work in the Django admin
> area.
>
> Could someone please point me in the right direction with this ?
>
> Thank you in advance.
>
>
>  --
> 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/-/NUO22GxW7UEJ.
> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: Installing Django from GIT/Subversion - package dependency in virtual environment

2012-02-20 Thread Denis Darii
Yes Mateusz, you understood right.

On Mon, Feb 20, 2012 at 4:07 PM, Mateusz Marzantowicz <
mmarzantow...@gmail.com> wrote:

> Yes, it works!
>
> Although I was previously installing Django according to docs at
> https://docs.djangoproject.com/en/1.3/topics/install/#installing-development-version,
>  your method works perfectly so far.
>
> I understand that keep in sync with trunk/master is as easy as invoking
> git pull (svn up) and then setup.py install in src/django directory in
> virtualenv root?
>
>
> Mateusz Marzantowicz
>
>
> On Mon, Feb 20, 2012 at 1:53 PM, Denis Darii wrote:
>
>> Do you mean django-trunk installation?
>>
>> If so, I use this in my requirements.txt:
>>
>> -e svn+http://code.djangoproject.com/svn/django/trunk/#egg=django-trunk
>>
>> or directly with pip:
>>
>> $ pip install -e svn+
>> http://code.djangoproject.com/svn/django/trunk/#egg=django-trunk
>>
>> Hope it helps.
>>
>> On Mon, Feb 20, 2012 at 1:36 PM, Mateusz Marzantowicz <
>> mmarzantow...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I'm having a problem with managing Django installation which was done
>>> from git repository
>>> (might be svn as well) in clean virtual environment. The problem is that
>>> when I install some
>>> other package via pip which has a Django as a dependency, it doesn't
>>> find my django installation
>>> and then downloads official release. I really need only one Django
>>> installation in my virtualenv,
>>> the one from git :) It is more related to how pip works but does anyone
>>> has any idea how to do it the right way?
>>>
>>>
>>> Thanks,
>>> Mateusz Marzantowicz
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> This e-mail and any file transmitted with it is intended only for the
>> person or entity to which is addressed and may contain information that is
>> privileged, confidential or otherwise protected from disclosure. Copying,
>> dissemination or use of this e-mail or the information herein by anyone
>> other than the intended recipient is prohibited. If you are not the
>> intended recipient, please notify the sender immediately by return e-mail,
>> delete this communication and destroy all copies.
>>
>> --
>> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: Any Singaporean Django developers out there?

2012-02-26 Thread Denis Darii
 Is there some demand for django programmers?

On Sun, Feb 26, 2012 at 5:21 AM, Kolbe  wrote:

> It's like Django is nonexistent in Singapore!
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: method for checking logged in user

2012-02-26 Thread Denis Darii
This is for you:
https://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.models.User.is_authenticated

On Sun, Feb 26, 2012 at 6:55 PM, rafiee.nima  wrote:

> Hi
> I want to know is there any built in function to check if a user is
> logged in
> actually I want to check if a user from a request is logged in or not
> tnx
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: internationalization makemessage don't work

2012-02-27 Thread Denis Darii
Hi Nicolas.
Try to run makemessages script from the root directory of your Django app,
so:

$ cd /your/app/path/
$ mkdir locale
$ django-admin.py makemessages -l en


On Mon, Feb 27, 2012 at 10:54 PM, nicolas HERSOG  wrote:

> Yes, I have my app in INSTALLED_APPS and I also have added this key in my
> settings :
>
> USE_I18N = True
> USE_L10N = True
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'debug_toolbar.middleware.DebugToolbarMiddleware',
> )
>
> TEMPLATE_CONTEXT_PROCESSORS = (
>  'django.contrib.auth.context_processors.auth',
> 'django.core.context_processors.debug',
>  '*django.core.context_processors.i18n*',
> 'django.core.context_processors.media',
>  'django.core.context_processors.static',
> 'django.contrib.messages.context_processors.messages'
> )
>
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'registration',
> 'mySUPERAPP',
> 'debug_toolbar',
> 'django.contrib.admin',
> 'captcha',
> )
>
> Did I miss something in MIDDLEWARE_CLASSES for exemple ?
>
> Ty all :)
>
> Nicolas
>
>
> On Mon, Feb 27, 2012 at 10:45 PM, Ian Clelland  wrote:
>
>> On Mon, Feb 27, 2012 at 1:36 PM, nicolas HERSOG wrote:
>>
>>> Fun fact, I tried the command manage.py compilemessages, it takes
>>> loong time to finish and parse all of my workspace in order to create
>>> translation file xD.
>>> All my home except my project :| ...
>>>
>>>
>> Does your INSTALLED_APPS setting contain the apps that should be
>> translated?
>>
>>
>> --
>> Regards,
>> Ian Clelland
>> 
>>
>> --
>> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: internationalization makemessage don't work

2012-02-27 Thread Denis Darii
Of course, from the django documentation(
https://docs.djangoproject.com/en/dev/topics/i18n/translation/#message-files
):

> The script should be run from one of two places:
>
>- The root directory of your Django project.
>- The root directory of your Django app.
>
> The script runs over your project source tree or your application source
> tree and pulls out all strings marked for translation.
>

So "The script runs over your project source tree or your application
source tree"...

On Mon, Feb 27, 2012 at 11:03 PM, nicolas HERSOG  wrote:

> I've already tried this, django created LC_MESSAGE folder in locale, but
> this folder is empty (no django.po file is generated :/)
>
> I'm guessing if the problem is not the way i tagged the things to
> translate ...
> I added to all the html files i wanted to translate the tag {% load i18n
> %} and all the strings i wanted to translate are between {%trans
> "myStringToTranslate" %}
>
> Is the fact that my /template folder is not in the same path than m apps
> may be a problem ?
>
>
> On Mon, Feb 27, 2012 at 10:58 PM, Denis Darii wrote:
>
>> Hi Nicolas.
>> Try to run makemessages script from the root directory of your Django
>> app, so:
>>
>> $ cd /your/app/path/
>> $ mkdir locale
>> $ django-admin.py makemessages -l en
>>
>>
>>
>> On Mon, Feb 27, 2012 at 10:54 PM, nicolas HERSOG wrote:
>>
>>> Yes, I have my app in INSTALLED_APPS and I also have added this key in
>>> my settings :
>>>
>>> USE_I18N = True
>>> USE_L10N = True
>>>
>>> MIDDLEWARE_CLASSES = (
>>> 'django.middleware.common.CommonMiddleware',
>>> 'django.contrib.sessions.middleware.SessionMiddleware',
>>> 'django.middleware.csrf.CsrfViewMiddleware',
>>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>>> 'django.contrib.messages.middleware.MessageMiddleware',
>>> 'debug_toolbar.middleware.DebugToolbarMiddleware',
>>> )
>>>
>>> TEMPLATE_CONTEXT_PROCESSORS = (
>>>  'django.contrib.auth.context_processors.auth',
>>> 'django.core.context_processors.debug',
>>>  '*django.core.context_processors.i18n*',
>>> 'django.core.context_processors.media',
>>>  'django.core.context_processors.static',
>>> 'django.contrib.messages.context_processors.messages'
>>> )
>>>
>>> INSTALLED_APPS = (
>>> 'django.contrib.auth',
>>> 'django.contrib.contenttypes',
>>> 'django.contrib.sessions',
>>> 'django.contrib.sites',
>>> 'django.contrib.messages',
>>> 'registration',
>>> 'mySUPERAPP',
>>> 'debug_toolbar',
>>> 'django.contrib.admin',
>>> 'captcha',
>>> )
>>>
>>> Did I miss something in MIDDLEWARE_CLASSES for exemple ?
>>>
>>> Ty all :)
>>>
>>> Nicolas
>>>
>>>
>>> On Mon, Feb 27, 2012 at 10:45 PM, Ian Clelland wrote:
>>>
>>>> On Mon, Feb 27, 2012 at 1:36 PM, nicolas HERSOG wrote:
>>>>
>>>>> Fun fact, I tried the command manage.py compilemessages, it takes
>>>>> loong time to finish and parse all of my workspace in order to create
>>>>> translation file xD.
>>>>> All my home except my project :| ...
>>>>>
>>>>>
>>>> Does your INSTALLED_APPS setting contain the apps that should be
>>>> translated?
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Ian Clelland
>>>> 
>>>>
>>>> --
>>>> 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, se

Re: Learning Django: DjangoProject Poll application

2012-02-29 Thread Denis Darii
try to use DjangoStack 1.4b1-0 instead of 1.3.1-1

On Wed, Feb 29, 2012 at 7:07 AM, WuWoot  wrote:

> https://docs.djangoproject.com/en/dev/intro/tutorial01/
>
> I'm using the Djangostack (Python 2.7.2+; Django 1.3.1-1) from Bitnami
> ran on Ubuntu 11.10 with PostgreSQL 9.1.2
>
> Sorry for my newbie question.
>
> I got to the portion where it asks me to import timezone from the
> django.utils module but all I manage to receive is:
>
> >>> from django.utils import timezone
> Traceback (most recent call last):
>  File "", line 1, in 
> ImportError: cannot import name timezone
>
> If I cannot do the above, I cannot get to the next line in the shell:
>
> >>> p = Poll(question="What's new?", pub_date=timezone.now())
>
>
> Anybody ever encounter this issue? I've attempted to look for a
> timezone setting in my settings.py and the only setting I can modify
> seems to be the location. A preliminary Google search and
> StackOverflow search turned up nothing. Your help is greatly
> appreciated. 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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 profile

2012-03-02 Thread Denis Darii
1. http://pinaxproject.com/
2. http://django-userena.org/

On Fri, Mar 2, 2012 at 9:26 PM, Bolang  wrote:

> Can someone suggest me an application for adding user profile to django?
> I have found 
> http://code.google.com/p/**django-profile/and
> https://bitbucket.org/**ubernostrum/django-profilesbut
>  those 2 projects don't receive update recently.
>
> 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+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: Template filters and translations to russian language

2012-03-07 Thread Denis Darii
Try to change also the language of your browser, this because you have
LANGUAGES = (('ru', 'Russian'), ('en_US', 'English'))

and probably in your browser is set EN.

Or force it to RU:

from django.utils.translation import activate
activate('ru')


On Wed, Mar 7, 2012 at 12:20 PM, Tom Evans  wrote:

> On Wed, Mar 7, 2012 at 9:38 AM, filias  wrote:
> > Hi,
> >
> > I am developing a website in russian and the original is in english. We
> are
> > using the po file to translate the strings.
> >
> > My problem now is that when I use template filters, for example date or
> > localnaturalday the translations do not appear. Everything appears in
> > english.
> > However, if I change the LANGUAGE_CODE from 'ru' to 'de_DE' everything
> > appears correctly in german.
> >
> > My settings are:
> >
> > LANGUAGES = (('ru', 'Russian'), ('en_US', 'English'))
> > LANGUAGE_CODE = 'ru'
> >
> > What am I missing here?
> >
> > Thanks for the help.
>
> I think you are missing this:
>
>
> https://docs.djangoproject.com/en/1.3/topics/i18n/localization/#locale-restrictions
>
> Although it looks like Django 1.3 has a ru translation, so I'm not
> convinced..
>
> Cheers
>
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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 hgwebdir

2012-03-07 Thread Denis Darii
using django? hmmm...

you can browse your current repo via http on port 8000 by launching:

$ hg se

or:

$ hg se -n "Your repo"

On Wed, Mar 7, 2012 at 1:39 PM, siva <85s...@gmail.com> wrote:

>
>
> Is it possible can we see hg repository using django ?
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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 admin login

2012-03-14 Thread Denis Darii
Try to create your superuser again:

./manage.py createsuperuser


On Wed, Mar 14, 2012 at 6:25 PM, vikalp sahni  wrote:

> You have to check your
>
> SESSION_COOKIE_DOMAIN in settings file if i.e pointing to "localhost" (if
> not cookies will not properly set and hence login will not be allowed)
>
> the best would be to use some host entry like example.com 127.0.0.1 and
> then use that in SESSION_COOKIE_DOMAIN and for accessing project on browser.
>
> Regards,
> //Vikalp
>
>
> On Wed, Mar 14, 2012 at 10:51 PM, dummyman dummyman wrote:
>
>>
>> Hi,
>> I created a new project in django
>>
>> 1.I created a new database
>> 2. I created a new user
>> 3.python manage syncdb
>> 4.python manae.py runserver
>>
>> when i visit localhost:8080/admin -> it asks for username n passwd. but
>> the login fails inspite of entering correct one
>>
>> But it works for a different project
>>
>> --
>> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: What directory do I install Django on Linux server

2012-03-14 Thread Denis Darii
Hello Alex.

Yes, when you install django using *"pip install django*" or "*python
setup.py install*" directly from the source, the code goes to the correct
directory inside of the "current" sites-packages.

To find out where your installed django code is placed you can simply run:

$ python -c "import django; print(django.__path__)"

Hope it helps.

On Wed, Mar 14, 2012 at 7:00 PM, Alex Glaros  wrote:

> Does it make any difference what directory I download and unzip Django
> tarball on a Linux server?
>
> Should it be nside the Python directory?
>
> When I install, does it find its correct directory by itself?
>
> thanks,
>
> Alex Glaros
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: playing with random number

2012-03-25 Thread Denis Darii
Nikhil please only django related questions here. Write to python-users
group for your problem but only after googling it... I'm pretty sure you
will find lots and lots of related questions/solutions.

Denis.

On 25 March 2012 19:07, Nikhil Verma  wrote:

> Hi all
>
> I have a list say
>
> li = [13,2,13,4]
>
> Now i want to use random number such that the list modifies into a
> dictionary like this:-
>
> di = {13: 'abc',2:'def',13:'abc',4:'xyz'}
>
> Point to be noted is if the list contains the number it should generate
> the same random number.
> How can i achieve this ?
>
> Thanks in advance.
>
> --
> Regards
> Nikhil Verma
> +91-958-273-3156
>
>  --
> 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.
>



-- 
I'm using Linux because i'm freedom dependent.

-- 
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: Simple question on queryset.

2012-03-27 Thread Denis Darii
I think the error "Memberships has no attribute all" is not related to your
QuerySet. Try to look deeply into your code.

BTW, your QuerySet must be:

queryset = Memberships.objects.get(id=4)

or better, if your id is also the primary key:

queryset = Memberships.objects.get(pk=4)

On 27 March 2012 08:57, Stanwin Siow  wrote:

>
> Hello,
>
> How do i transform this SQL query into a queryset?
>
> select membership_type from memberships where id ='4'
>
> i tried the following:
>
> queryset = Memberships.objects.get(id__exact=4)
>
> however django is throwing me an error with the following:
>
> Memberships has no attribute all.
>
>
> I know this is a trivial question but i've been through the tutorials
> https://docs.djangoproject.com/en/dev/topics/db/queries/
>
> and i don't unds where this error is coming from.
>
> Do appreciate any help rendered.
>
> Thank you.
>
>
> Best Regards,
>
> Stanwin Siow
>
>
>
>  --
> 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.
>



-- 
I'm using Linux because i'm freedom dependent.

-- 
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 with get_or_create

2012-04-23 Thread Denis Darii
Murilo, try to debug your "task" variable - must be an int.
Also next time please provide full traceback of your error.

On 23 April 2012 17:42, akaariai  wrote:

> On Apr 23, 4:26 pm, Murilo Vicentini 
> wrote:
> > Hey guys,
> > I'm having a bit of a problem using the get_or_create with a
> > ManyToManyField in my model.
> > class Run(models.Model):
> > distros = models.ForeignKey('Distro')
> > compilers = models.ManyToManyField('Compiler', blank=True,
> > null=True)
> > adapters = models.ForeignKey('Adapter')
> >
> > Task = models.IntegerField()
> > Path = models.CharField(max_length = 300)
> > Date_Time = models.DateTimeField()
> >
> > class RunForm(ModelForm):
> > class Meta:
> > model = Run
> >
> > What I'm trying to do is merely trying to save in the database if the
> entry
> > does not exist already (hence why I'm trying to use get_or_create). Here
> is
> > how I'm doing:
> > fields = {
> >  'Task': task,
> >  'Path': runpath,
> >  'Date_Time': datetime(2012, 4, 10, 10, 20, 0),
> >  'adapters': adapters.id,
> >  'distros': distros.id,}
> >
> > form = RunForm(fields)
> > if form.is_valid():
> >   runs, created = Run.objects.get_or_create(**form.cleaned_data)
>
> Try "runs = form.save()", get_or_create doesn't seem to be the correct
> method in this situation.
>
> If you want to skip some fields you can use the form's Meta attributes
> to do that.
>
>  - Anssi
>
> --
> 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.
>
>


-- 
I'm using Linux because i'm freedom dependent.

-- 
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 + ajax waiting page, can not redirect to result page

2011-12-16 Thread Denis Darii
You can view your js errors by pressing CTRL+SWIFT+J in Firefox but i
highly recommend you to install Firebug addon which allow you to view also
the received data from your ajax request.

On Fri, Dec 16, 2011 at 5:24 AM, yun li  wrote:

> Since I am really know nothing about ajax, I am not sure if I
> understand "try changing the return value from the view to a string "
> the right way. I changed the definition of run_DHM this way
>
> def run_DHM(request):
>xx = {'ok':true}
>return(xx)
>
> but still the same as before.
>
> and how I can check if there is any error in JavaScript console in my
> browser ?
>
>
> On 12月15日, 上午8时57分, Brett Epps  wrote:
> > I think the problem might be that you're using the getJSON function,
> which
> > expects a JSON response, but your view returns 'OK', which is not valid
> > JSON. The callback you have given to getJSON only gets called on
> "success"
> > (meaning a JSON document was retrieved) - that's why nothing is happening
> > for you right now. Try changing the return value from the view to a
> string
> > containing:
> >
> > {"ok": true}
> >
> > And then change this line in the JavaScript:
> >
> > if (data == 'OK') {
> >
> > to:
> >
> > if (data.ok) {
> >
> > I think it should work with those changes. If it doesn't, try checking
> the
> > JavaScript console in your browser for any errors.
> >
> > Brett
> >
> > On 12/14/11 4:03 PM, "yun li"  wrote:
> >
> >
> >
> >
> >
> >
> >
> > >But it still cannot work. when I submit something, it goes to the
> > >please_wait page showing "please wait" and then nothing happened. I
> > >really have no knowledge on ajax, so is there something I need to
> > >install or import in my projects? and how can I test if codes in
> > > ... really invoked?
> >
> > >Thanks,
> >
> > >On 12月14日, 下午1时47分, Brett Epps  wrote:
> > >> I think the problem is that your  tag is incorrect. You're
> using
> > >> the same one to load jQuery and to add your code, so your JavaScript
> is
> > >> not getting run. The file "please_wait.html" should look like this:
> >
> > >> 
> > >> 
> > >> 
> > >> Please wait.
> > >> 
> > >>