check user status

2013-08-12 Thread Scheck Nyori
Hi,
How do i check whether a user has liked an object or not? And if yes, how
do block the user from liking it again? Any help will be appreciated.
Thanks.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django windows user

2013-08-12 Thread gilberto dos santos alves
search google for cpanel many providers have this (also google have one). 
and see lots of steps that you could use. [1] 

[1] https://cpanel.net/

Em sábado, 10 de agosto de 2013 19h27min47s UTC-3, Robin Lery escreveu:
>
> Hello,
> I am a windows user, and its great learning django and python as well. I 
> am just curious that, when I happen to deploy my site for production, is it 
> helpful to deploy in unix system. And if there is, please guide me to use 
> ssh and other stuff that is required to deploy so. Any help will be highly 
> appreciated.
> Thank you.
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Getting Timezone conversion in template with USE_TZ = False;

2013-08-12 Thread Lee Hinde
I'm displaying a date/time field in template.

Data in the database: 2013-05-30 00:00:00
template tag:   {{ reg.registration_date  }}
as displayed in the web page: May 29, 2013, 5 p.m.

I didn't have a USE_TZ setting until I tried to figure out what was
happening here.

The data I'm playing with now was all migrated from another system directly
to the backend, i.e., I didn't migrate through django.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Creating an "Edit Page"

2013-08-12 Thread Liz
I've been struggling in creating an edit page and I need help, please!

The goal is to get the user to search a record and when they click on the 
link, I would like to use form.p with the values it finds from the 
database. 

For example if they search a name and click on the person that is already 
stored in the database, they should be redirected to a page where it shows 
a form with the person's information and the user should be able to edit 
and save the changes. 

I would appreciate any time of help to accomplish this. 

I've been thinking to do the following but I do not believe I'm on the 
right track:

 
*html page*
 

{{form.as_p}}




*view*
*
*
  def person(request, person_id=1):   
   return render_to_response('edit.html', 
  {'article': Data.objects.get(id=person_id) })

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: broken packages

2013-08-12 Thread Aaron C. de Bruyn
This isn't a django issue, but rather an issue with the package management
system in your Linux distribution.

This can happen if someone publishes a broken package, or you add on PPA's
that have conflicting requirements.

Basically it's saying that geonode depends on a version of Django greater
than 1.5.1 but version 1.4.1 is installed.  It may be that 1.5.1 is not
available in your distro yet.

You might try the Debian or Ubuntu forums for further assistance.

-A



On Mon, Aug 12, 2013 at 9:32 AM, Truongxuan Quang  wrote:

> I run command
> $sudo apt-get install geonode
> it showed as the list bellows:
>
>  geonode : Depends: python-django (>= 1.5.1) but 1.4.1-2ubuntu0.3 is to be
> installed
>Depends: python-agon-ratings but it is not installable
>Depends: python-dialogos but it is not installable
>Depends: python-django-activity-stream but it is not installable
>Depends: python-django-forms-bootstrap but it is not installable
>Depends: python-django-friendly-tag-loader but it is not
> installable
>Depends: python-django-geoexplorer but it is not installable
>Depends: python-django-jsonfield but it is not installable
>Depends: python-django-taggit but it is not installable
>Depends: python-django-taggit-templatetags but it is not
> installable
>Depends: python-django-user-accounts but it is not installable
>Depends: python-geonode-avatar but it is not installable
>Depends: python-gisdata but it is not installable
>Depends: python-gsconfig but it is not installable
>Depends: python-owslib but it is not installable
>Depends: python-pycsw but it is not installable
>Depends: python-paver but it is not installable
>Depends: python-user-messages but it is not installable
>Depends: python-django-announcements but it is not installable
>Depends: python-pinax-theme-bootstrap but it is not installable
>Depends: python-pinax-theme-bootstrap-account but it is not
> installable
> E: Unable to correct problems, you have held broken packages.
>
> I have used
> $sudo apt-get clean, autoclean, and install -f in order to fix packages
> but i was not success
>
> Please help me to fix these
>
> Many thanks
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django: Temporary "wait page" while heavy compute processing is handled

2013-08-12 Thread François Schiettecatte
Hi

Another option is to email something with a link to a page where they can pick 
up their job results, you could easily generate a one-time token which can be 
inserted into a table and in the email as part of a url.

You could even you the same table as your job queue, rows missing their tokens 
still need to be processed, and you can check the url against the tokens for 
validity.

Finally you could also age out old rows at which point the tokens would be 
invalid.

François

On Aug 12, 2013, at 12:06 PM, Nick Santos  wrote:

> Hi Howard,
> 
> You will want to look into Celery, which lets you do heavy processing outside 
> of your web requests. You can then use some checking via Javascript to see if 
> the work is done yet and load a new page, or ask the user to come back later. 
> There's a celery "app" for django that makes certain tasks a little easier. 
> Sorry I can't provide more details than pointing you there right now, but I 
> hope that helps. Someone on this list may have some better options for you 
> that involve less setup, but Celery is the first thing that came to mind for 
> me.
> 
> Also, just as an FYI, your links won't work because they point to your local 
> development server and can't be accessed by anyone else.
> -Nick
> 
> 
> 
> On Mon, Aug 12, 2013 at 8:49 AM, Julio Molina Soler  
> wrote:
> Hi Howard,
> 
> I'm not very experience with django yet, but if you are not very familiar 
> with Ajax I recommend to have a look on jQuery, I also have no experience 
> with Ajax, that's why I work with it, I find it more friendly, and get the 
> things nicely done (mostly popup menus and so on). That link may help you
> http://jqueryui.com/progressbar/
> 
> I hope someone can give you a better django approach, but I think the clean 
> one would be via Ajax.
> 
> Julio
> 
> 
> On Monday, August 12, 2013 6:28:35 AM UTC+2, Howard S wrote:
> Hi everyone,
> 
> I have a page whose content cannot be loaded until a lot of computations are 
> done, which may take a minute or two. How can I set up a temporary "wait 
> page" that will direct users to a new link once the computing is done?
> 
> For example:
> User submits an input: http://127.0.0.1:8000/tools/submit/ 
> User waits for output: http://127.0.0.1:8000/tools/WaitPlease/
> User receives the output: http://127.0.0.1:8000/tools/result/
> 
> If such redirect is a bad practice, can should i do this via AJAX (which I am 
> not very familiar with)?
> 
> Please and thank you.
> 
> Best,
> Howard
> 
> 
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
> 
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How can I order my list based on a field in a different table?

2013-08-12 Thread Pepsodent Cola
Thank you Eric for the pointers!

But I think Django is complaining about me having too many Relationships in 
table Altword, or perhaps I have typed syntax wrong and missunderstand the 
error message?

Exception Value: 

 has more than 1 ForeignKey to 



#___

class Word(models.Model):
rosword = models.CharField(max_length=200)
direct_transl_word = models.CharField(max_length=120, blank=True, 
null=True)
pub_date = models.DateTimeField('date published')

def __unicode__(self):
return self.rosword
#___

class Altword(models.Model):
#class Altword(Word):
rosword = models.*ForeignKey*(Word)
alt_ros_word = models.CharField(max_length=200)
alt_transl_word = models.CharField(max_length=200)
articulate = models.CharField(max_length=200)
wordy = models.*OneToOneField*(Word, related_name='altword_wordy', 
primary_key=True)
votes = models.IntegerField(default=0)
pub_date = models.DateTimeField('date published')

def __unicode__(self):
return self.alt_ros_word
#___



First I tried to follow this example but then above error showed up:
https://docs.djangoproject.com/en/1.5/topics/db/examples/one_to_one/


Second time I tried this but I couldn't make it work:
http://catherinetenajeros.blogspot.se/2013/04/django-error-one-or-more-models-did-not.html

Third time I tried to play with "Multi-table inheritance".  But it only 
lead to Django complaining about duplicate fields which suggested that I 
needed to change field names in several files.  I didn't go down that path. 
 And it seemed "Multi-table inheritance" also complained about my first 
error message about having too many relationships in Altword table.
https://docs.djangoproject.com/en/1.0/topics/db/models/#id7


How should I proceed in order to find the solution to this problem?






On Saturday, August 10, 2013 10:32:37 AM UTC+2, Eric Cheung wrote:
>
> 1) The model Word does not have the votes field, you cannot order the 
> field it's not possessed.
>
> 2) You have to build a relation between the models first, check the 
> relationships from Django Doc 
> https://docs.djangoproject.com/en/dev/topics/db/models/#relationships
>   
> On Friday, August 9, 2013 10:04:47 PM UTC+8, Pepsodent Cola wrote:
>>
>> 1.)
>> How can I order my list based on a field in a different table?
>>
>> return Word.objects.filter(direct_transl_word='')
>>
>> The above I want to do something like this where the field ('-votes') is 
>> located at table Altword.
>> Nothing happens when I use this though, don't understand why?
>>
>> #return 
>> Word.objects.filter(direct_transl_word='').order_by('-votes')
>>
>>
>> 2.)
>> My *altword_list.html* viewpage breaks whenever I try to use query for 
>> my other table Altword.
>>
>> #return Altword.objects.filter(rosword__direct_transl_word='')
>> #return Altword.objects.filter(word__direct_transl_word='')
>>
>> #___
>>
>> *AltwordlistView*
>> class AltwordlistView(generic.DetailView):
>> model = Word
>> #model = Altword
>> template_name = 'navi_polls/altword_list.html'
>> context_object_name = 'poll'
>>
>> def get_queryset(self):
>> # Filter 5
>> return Word.objects.filter(direct_transl_word='')
>> #return 
>> Word.objects.filter(direct_transl_word='').order_by('-votes')
>> #return Altword.objects.filter(rosword__direct_transl_word='')
>> #return Altword.objects.filter(word__direct_transl_word='')
>>
>> #___
>>
>> *Models*
>> class Word(models.Model):
>> rosword = models.CharField(max_length=200)
>> direct_transl_word = models.CharField(max_length=120, blank=True, 
>> null=True)
>> pub_date = models.DateTimeField('date published')
>>
>> def __unicode__(self):
>> return self.rosword
>>
>> #___
>>
>> *Models*
>> class Altword(models.Model):
>> rosword = models.ForeignKey(Word)
>> alt_ros_word = models.CharField(max_length=200)
>> alt_transl_word = models.CharField(max_length=200)
>> articulate = models.CharField(max_length=200)
>> *votes* = models.IntegerField(default=0)
>> pub_date = models.DateTimeField('date published')
>>
>> def __unicode__(self):
>> return self.alt_ros_word
>>
>>
>>
>>
>>

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

Re: problem with deploying django using mod wsgi

2013-08-12 Thread Rob Ladd
It may be looking in html because it isn't getting the definition from the 
view method or class, so it's going with the default.
Try importing everything in views:
from webapp import views *

On Saturday, August 10, 2013 3:46:19 AM UTC-4, WongoBongo wrote:
>
> Is your form (on page /mice/search_mice/) submitting to
>
> /mice/search
>
> or
>
> /search
>
> Check your form element in the html document. Is it pointing to the right 
> URL?
>
> Maybe check your WSGIScriptAlias setting. Maybe verify your DocumentRoot 
> setting.
>
> You might also want to check the request and response using a tool like 
> HttpFox
>
> K
>
>
>
> On Thursday, August 8, 2013 6:10:34 AM UTC-7, sah wrote:
>>
>> I have this error in the error_log file :
>>
>>  [error] [client 10.10.8.41] File does not exist: /var/www/html/search, 
>> referer: http://tarinformatics03/mice/search_mice/
>>
>> search is one of my view function why is it looking for it in the html 
>> directory ??
>>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




broken packages

2013-08-12 Thread Truongxuan Quang
I run command 
$sudo apt-get install geonode
it showed as the list bellows:

 geonode : Depends: python-django (>= 1.5.1) but 1.4.1-2ubuntu0.3 is to be 
installed
   Depends: python-agon-ratings but it is not installable
   Depends: python-dialogos but it is not installable
   Depends: python-django-activity-stream but it is not installable
   Depends: python-django-forms-bootstrap but it is not installable
   Depends: python-django-friendly-tag-loader but it is not 
installable
   Depends: python-django-geoexplorer but it is not installable
   Depends: python-django-jsonfield but it is not installable
   Depends: python-django-taggit but it is not installable
   Depends: python-django-taggit-templatetags but it is not 
installable
   Depends: python-django-user-accounts but it is not installable
   Depends: python-geonode-avatar but it is not installable
   Depends: python-gisdata but it is not installable
   Depends: python-gsconfig but it is not installable
   Depends: python-owslib but it is not installable
   Depends: python-pycsw but it is not installable
   Depends: python-paver but it is not installable
   Depends: python-user-messages but it is not installable
   Depends: python-django-announcements but it is not installable
   Depends: python-pinax-theme-bootstrap but it is not installable
   Depends: python-pinax-theme-bootstrap-account but it is not 
installable
E: Unable to correct problems, you have held broken packages.

I have used 
$sudo apt-get clean, autoclean, and install -f in order to fix packages but 
i was not success 

Please help me to fix these

Many thanks

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: south in windows

2013-08-12 Thread Karl Arunachal
Thank you! That solved my problem.


On Mon, Aug 12, 2013 at 5:05 AM, Mike Dewhirst wrote:

> On 12/08/2013 5:36am, Karl Arunachal wrote:
>
>> Hi,
>> I am trying to sync south in my db, but i can't sync it. Its giving me
>> an error:
>> (use ./manage.py migrate to migrate these)
>> Is there anyway to do this command, "./manage.py", in windows. I could
>> have done it by chmod + x manage.py in other os. But how do i do it in
>> windows? Is there any other way around to sync south in windows?
>> Thank you.
>>
>
> In Windows, the ./ is unnecessary. The command you want is ...
>
>  C:\path\to\managepy\python manage.py migrate
>
> ... where Windows knows how to launch Python and Python knows that
> manage.py is in the current working directory.
>
> hth
>
>
>> --
>> 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+unsubscribe@**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
>> .
>> For more options, visit 
>> https://groups.google.com/**groups/opt_out
>> .
>>
>>
>>
> --
> 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+unsubscribe@**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
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>
>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django: Temporary "wait page" while heavy compute processing is handled

2013-08-12 Thread Nick Santos
Hi Howard,

You will want to look into Celery , which lets
you do heavy processing outside of your web requests. You can then use some
checking via Javascript to see if the work is done yet and load a new page,
or ask the user to come back later. There's a celery "app" for django that
makes certain tasks a little easier. Sorry I can't provide more details
than pointing you there right now, but I hope that helps. Someone on this
list may have some better options for you that involve less setup, but
Celery is the first thing that came to mind for me.

Also, just as an FYI, your links won't work because they point to your
local development server and can't be accessed by anyone else.
-Nick



On Mon, Aug 12, 2013 at 8:49 AM, Julio Molina Soler wrote:

> Hi Howard,
>
> I'm not very experience with django yet, but if you are not very familiar
> with Ajax I recommend to have a look on jQuery, I also have no experience
> with Ajax, that's why I work with it, I find it more friendly, and get the
> things nicely done (mostly popup menus and so on). That link may help you
> http://jqueryui.com/progressbar/
>
> I hope someone can give you a better django approach, but I think the
> clean one would be via Ajax.
>
> Julio
>
>
> On Monday, August 12, 2013 6:28:35 AM UTC+2, Howard S wrote:
>>
>> Hi everyone,
>>
>> I have a page whose content cannot be loaded until a lot of computations
>> are done, which may take a minute or two. How can I set up a temporary
>> "wait page" that will direct users to a new link once the computing is done?
>>
>> For example:
>> User submits an input: 
>> http://127.0.0.1:8000/tools/**submit/
>>
>> User waits for output: 
>> http://127.0.0.1:8000/tools/**WaitPlease/
>> User receives the output: 
>> http://127.0.0.1:8000/tools/**result/
>>
>> If such redirect is a bad practice, can should i do this via AJAX (which
>> I am not very familiar with)?
>>
>> Please and thank you.
>>
>> Best,
>> Howard
>>
>>
>>  --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django: Temporary "wait page" while heavy compute processing is handled

2013-08-12 Thread Julio Molina Soler
Hi Howard,

I'm not very experience with django yet, but if you are not very familiar 
with Ajax I recommend to have a look on jQuery, I also have no experience 
with Ajax, that's why I work with it, I find it more friendly, and get the 
things nicely done (mostly popup menus and so on). That link may help you
http://jqueryui.com/progressbar/

I hope someone can give you a better django approach, but I think the clean 
one would be via Ajax.

Julio

On Monday, August 12, 2013 6:28:35 AM UTC+2, Howard S wrote:
>
> Hi everyone,
>
> I have a page whose content cannot be loaded until a lot of computations 
> are done, which may take a minute or two. How can I set up a temporary 
> "wait page" that will direct users to a new link once the computing is done?
>
> For example:
> User submits an input: http://127.0.0.1:8000/tools/submit/ 
> User waits for output: http://127.0.0.1:8000/tools/WaitPlease/
> User receives the output: http://127.0.0.1:8000/tools/result/
>
> If such redirect is a bad practice, can should i do this via AJAX (which I 
> am not very familiar with)?
>
> Please and thank you.
>
> Best,
> Howard
>
>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Custom auth backend and importing custom user model

2013-08-12 Thread Rok Jaklič
Hi,

I wrote custom auth backend, however when I try to import custom user model 
I get an error like:
ImportError: cannot import name "CustomUser" 

even though I have in custom_auth.py from users.models import CustomUser.

I found out that custom_auth.py is called before custom models.

Any ideas how could I solve this problem?

Kind regards,

Rok


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Error: ImportError: No module named south

2013-08-12 Thread Tito Gonzales
before installing psycopg2 you have to install Postgres, you did it right? 
To test the south use the sqlite3 first then switch to Postgres

Em domingo, 11 de agosto de 2013 08h30min54s UTC-3, alekto.a...@gmail.com 
escreveu:
>
> Hi, 
> am using django==1.5.1 and south==0.8.2, as well as pip-1.1-py2.7.egg 
> (python 2.7)
> I keep getting this error: ImportError: No module named south, when I run: 
> sudo python manage.py syncdb.
> I have added south as the last line to my INSTALLED_APPS in settings.py.
>
> Does anyone here have a suggestion how to solve this? 
> Thanks in advance!
>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Incrementing the slug by avoiding Integrity error in django models save method

2013-08-12 Thread shiva krishna
I have a model with two fields as below

**models.py**

class Publisher(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField(max_length=150, unique=True)

def save(self, *args, **kwargs):
if not self.id and not self.slug:
slug = slugify(self.name)
try:
slug_exits = Publisher.objects.get(slug=slug)
if slug_exits:
self.slug = slug + '_1'
except Publisher.DoesNotExist:
self.slug = slug
super(Publisher, self).save(*args, **kwargs)

Here i am creating a slug based on the `name` field as we can see above

So when we try to create a publisher with `name already exists`, the `save` 
method of the model will add the `_1` to the end.

And when we again try to create a new record with same `name`, an 
`Integrity` error will be raised as below

>> Publisher.objects.create(name="abc")
   result: slug will be "abc"
>> Publisher.objects.create(name="abc")
   result: slug will be "abc_1"
>> Publisher.objects.create(name="abc")
   result: 

 .
 .
 34 del cursor
 35 del connection
---> 36 raise errorclass, errorvalue
 37 
 38 re_numeric_part = re.compile(r"^(\d+)")

IntegrityError: (1062, "Duplicate entry 'abc_1' for key 'slug'")

So what i am want is if the title/slug already exists in the database and 
if slug contains number in it(at the end like abc`_1`), we should increment 
it that number

So what all i want is to `increment the number in the slug`  as below if 
the title/slug already exists in the database

abc
abc_1
abc_2
abc_3  

So can anyone please let me know how to implement the above logic of 
incrementing the slug ?

Thanks in advance..

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: __unicode__() addition not working in basic poll application.

2013-08-12 Thread Waqas Javed
I was having the same problem my django version was 1.3.1 and python 2.7. 
There was indentation problem with my code after correcting it my problem 
was solved.

On Tuesday, June 14, 2011 11:01:54 PM UTC+5, Kyle Latham wrote:
>
> Hello, 
>
> I am having the same problem while working through the tutorial. have 
> searched these forums and tried everything that was recommended. My 
> spacing is good also - I checked that.  I am still getting the same 
> output: 
>
> >>> Poll.objects.all() 
> [] 
>
> Any ideas on how to fix my issue? 
>
> On Jun 5, 11:20 am, EPS  wrote: 
> > Hi, i found this post when try to solve same problem: my trouble was a 
> > "spaces" in models.py. 
> > in your first message it seems to be ok, but you must really check 
> > spaces in your class describe.
> http://mail.python.org/pipermail/tutor/2007-January/051903.html 
> > 
> > On May 17, 4:59 pm, maaz muqri  wrote: 
> > 
> > 
> > 
> > > im just getting "Pollobject" as output 
> > 
> > > On May 17, 1:14 pm, Roman Klesel  
> wrote:> 2011/5/16 maaz muqri : 
> > 
> > > > > I am getting this 
> > 
> > > > Poll.objects.all() 
> > > > > [] 
> > 
> > > > What do you get when you do: 
> > 
> > > > print unicode(Poll.objects.all()[0]) 
> > 
> > > > ? 
> > 
> > > > Regards 
> > > >  Roman- Hide quoted text - 
> > 
> > - Show quoted text -

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Django: Temporary "wait page" while heavy compute processing is handled

2013-08-12 Thread Howard S
Hi everyone,

I have a page whose content cannot be loaded until a lot of computations 
are done, which may take a minute or two. How can I set up a temporary 
"wait page" that will direct users to a new link once the computing is done?

For example:
User submits an input: http://127.0.0.1:8000/tools/submit/ 
User waits for output: http://127.0.0.1:8000/tools/WaitPlease/
User receives the output: http://127.0.0.1:8000/tools/result/

If such redirect is a bad practice, can should i do this via AJAX (which I 
am not very familiar with)?

Please and thank you.

Best,
Howard


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django windows user

2013-08-12 Thread Robin Lery
Thank you all! Just one more question though, does hosting provider
provides any interface like virtual machine or so? It would have been great
if they were.


On Mon, Aug 12, 2013 at 5:09 AM, Mike Dewhirst wrote:

> On 12/08/2013 8:47am, Aaron C. de Bruyn wrote:
>
>> MySQL or Postgresql for your database,  followed by some basic SSH/SCP
>> knowledge.  For Windows users I recommend two tools:  PuTTY and WinSCP.
>>
>
> If you have a choice go with PostgreSQL and Filezilla is a useful tool
> which knows the SSL/TLS protocols.
>
>
> --
> 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+unsubscribe@**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
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ImportError: No module named 'exceptions' - Python3

2013-08-12 Thread Mike Dewhirst

On 12/08/2013 3:21pm, abhijeet shete wrote:

Hi Folks,

 I ported my project from python2.7 to python3 using 2to3 module.
One of my class is inherited from Exception class, but after porting to
python3 i am getting *No module named 'exceptions' *error.

 My class looks something like this :-



Try it without importing Exception. Looking at django.core.exceptions it 
seems specifically importing Exception is not required.



*from exceptions import Exception*
*class A(Exception):*
*def __init__(self, value=None):*
*self.value = value*
*
*
And the error which I am getting is
*
*
Traceback (most recent call last):
   File "", line 1, in 
ImportError: No module named 'exceptions'


I tried to import exceptions in python3 shell but there also I am
getting same error.
Is there any problem with my code or did I missed something while
porting or python3 itself has some problem while importing exceptions ?


Thanks and Regards.
Abhijeet Shete

--
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.
For more options, visit https://groups.google.com/groups/opt_out.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ImportError: No module named 'exceptions' - Python3

2013-08-12 Thread Jani Tiainen
Hi,

In Python 3 exceptions module was removed and all standard exceptions were 
moved to builtin module. Thus meaning that there is no more need to do explicit 
import of any standard exceptions.


On Mon, 12 Aug 2013 10:51:32 +0530
abhijeet shete  wrote:

> Hi Folks,
> 
> I ported my project from python2.7 to python3 using 2to3 module. One of
> my class is inherited from Exception class, but after porting to python3 i
> am getting *No module named 'exceptions'  *error.
> 
> My class looks something like this :-
> 
> *from exceptions import Exception*
> *class A(Exception):*
> *def __init__(self, value=None):*
> *self.value = value*
> *
> *
> And the error which I am getting is
> *
> *
> Traceback (most recent call last):
>   File "", line 1, in 
> ImportError: No module named 'exceptions'
> 
> 
> I tried to import exceptions in python3 shell but there also I am getting
> same error.
> Is there any problem with my code or did I missed something while porting
> or python3 itself has some problem while importing exceptions ?
> 
> 
> Thanks and Regards.
> Abhijeet Shete
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.