Re: Setting urls from project

2013-01-18 Thread Peter of the Norse
This is exceptionally wrong! If you put a $ in the pattern, it will only 
match those urls. For example the uri http://localhost/cadastro/56/ 
won't match anything. Only http://localhost/cadastro/ would match, and 
if you're including another url file, I doubt that's what you want.


On 12/24/2012 12:01 AM, Matthew Edwards wrote:
I'm still learning Django myself, but I believe each url should end 
with '$' in order to stop the regex match at the forward slash.


So your new URIs would be:
url(r'^cadastro/$', include('contact.urls')),
url(r'^contato/$', include('contact.urls')),
url(r'^sobre/$', include('contact.urls')),
url(r'^admin/$', include(admin.site.urls)),

I hope that solves your problem.

On Sunday, December 23, 2012 9:19:50 AM UTC-8, Filipe Manuel wrote:

I wish that when from accessing localhost:8000/cadastro he showed
a form to register, but all the urls I click redirects to the same
page. I wonder how pegging the url with the url of the
application. I've Identified the error, all urls design guide for
single views of the application, but do not know how to fix it.

My code: http://dpaste.com/850276/

--
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/-/bBbW61gCokIJ.

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.



--
Peter of the Norse

--
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: Getting error 500 when using jquery/ajax

2013-01-18 Thread Mario Gudelj
Replicate this error in chrome, then go to network tab in dev tools, look
at the request that gets 500 and check the response. You should be able to
see the stack trace if debug is on.
On 19 Jan, 2013 8:01 AM, "Dex"  wrote:

> Hi, I'm new to Django. I'm creating a game that has a 10x10 board and when
> a cell is clicked upon, it will be marked with an "X". Marking the cells
> works in jquery but I want to send data to server side to let it know that
> the cell is marked. That way when I quit the  game and come back later, it
> will have an "X" on that cell. Currenly, my jquery code is this:
> $('.target_cell').click(function(){
> if ($(this).text() != "X" && $(this).text() != "H"){
> $(this).text("X");
> var spot = $(this).attr('name'); //Cell index number like
> in an array but in string format
> $.ajax({
> type: "POST",
> url: "/target_spot/{{game.id}}/" + spot + "/",
> data: spot
> });
> }
>
> And my view code is this:
> @csrf_exempt
> def target_spot(request, game_id, spot):
> if request.is_ajax():
> game = fetch_game(request.user, game_id)
> game.creator_target_board[int(spot)] = "X"
> game.save()
>
> From my server log, i get the following message when I click on a cell:
> "POST /target_spot/1/0/ HTTP/1.1" 500. Any ideas on how to solve this?
> Thanks!
>
> --
> 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/-/Aux0I4-eUNMJ.
> 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: Error: No module named books

2013-01-18 Thread Sandip Sinha
Thanks Chris. Your response just saved my day! I was able to get past this 
issue!! 
 
- Sandip
 

On Thursday, November 29, 2012 6:24:36 PM UTC-8, Chris Recher wrote:

> Thanks for the help everyone. I was using 1.4.x, not the 1.0 the book is 
> based on. After fooling around with the commands for a bit, I was able to 
> figure out that the problem was in the INSTALLED_APPS section - I included 
> 'mysite.books', but the new way to do that is just 'books'.
>

-- 
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/-/9eacXUX8D0EJ.
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.



Getting error 500 when using jquery/ajax

2013-01-18 Thread Dex
Hi, I'm new to Django. I'm creating a game that has a 10x10 board and when 
a cell is clicked upon, it will be marked with an "X". Marking the cells 
works in jquery but I want to send data to server side to let it know that 
the cell is marked. That way when I quit the  game and come back later, it 
will have an "X" on that cell. Currenly, my jquery code is this:
$('.target_cell').click(function(){ 
if ($(this).text() != "X" && $(this).text() != "H"){
$(this).text("X");
var spot = $(this).attr('name'); //Cell index number like 
in an array but in string format
$.ajax({
type: "POST",
url: "/target_spot/{{game.id}}/" + spot + "/",
data: spot
});
}

And my view code is this: 
@csrf_exempt
def target_spot(request, game_id, spot):
if request.is_ajax():
game = fetch_game(request.user, game_id)
game.creator_target_board[int(spot)] = "X"
game.save()

>From my server log, i get the following message when I click on a cell: 
"POST /target_spot/1/0/ HTTP/1.1" 500. Any ideas on how to solve this? 
Thanks!

-- 
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/-/Aux0I4-eUNMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to deploy Django apps with Google App Engine

2013-01-18 Thread Londerson Araújo
Man, first, GAE dont accept the ORM of Django, and you need use somethin
called Django-Nonrell, you will find in this site,
http://www.allbuttonspressed.com/projects/django-nonrel.

I think Heroku is better, and more simple to deploy!

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



How to deploy Django apps with Google App Engine

2013-01-18 Thread Harit Himanshu
Hello Everyone

I am new user of Django and this community and want to know how can we 
deploy Django apps on Google App Engine.
Are there Easy, Simple ways to accomplish it? 

Please guide me through your experiences, resources that you are aware of

Thank you very much
+ Harit Himanshu

-- 
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/-/WQcO4wRSEJkJ.
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 lucene

2013-01-18 Thread Amirouche Boubekki
Héllo,

I'm curious why do you use lucene instead of solr ?

Thanks


2013/1/18 Harry Houdini 

>
> I originally went down this path but I too ran into many problems getting
> this to work and ended up using Whoosh instead. The site was small ~30
> pages or so it was still pretty fast. I had it index by reading the sitemap
> and pulling down the page content from the web server. I used
> BeautifulSoup4 to get the page title to store in the Whoosh DB. Anyway,
> just another option to consider.
>
>
>
> On Tuesday, August 25, 2009 10:55:59 AM UTC-4, Puneet wrote:
>
>> Hi,
>>
>> Does anyone have tried django-lucene module for search ??
>>
>> I am able to compile the lucene and jcc as  required but the module is
>> not working properly as it is expected to work.  As mentioned in the
>> docs I have added to fields in my model
>>
>>objects = models.Manager()
>>objects_search = Manager() # add search manager
>>
>> But when I say ModelName.save() its not getting indexed with lucene
>> and when I say
>>
>>  ModelName.objects.objects_**search(name_first="Spike")
>>
>> I am getting error that
>>
>> AttributeError: 'Manager' object has no attribute 'objects_search'
>>
>> Can any one help me with this ?? Does anyone have a small working
>> example ?
>>
>> Thanks,
>> Puneet
>>
>  --
> 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/-/Ys0rcBWSMp0J.
>
> 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: Getting a no such column error when adding data and syncdb is not syncing

2013-01-18 Thread Tom Evans
On Fri, Jan 18, 2013 at 3:38 PM, Nick  wrote:
> This is my first django project outside of the tutorials and it's
> frustrating to stumble over something so simple.
>
> I'm getting this error when I try to add a product:
>>
>> DatabaseError at /admin/products/product/add/
>>
>> table products_product has no column named pub_date
>
>
> This is what my models.py file looks like:
>>
>> from django.db import models
>>
>> class Product(models.Model):
>> name = models.CharField(max_length = 200)
>> desc = models.TextField()
>> pub_date = models.DateTimeField()
>>
>> def __unicode__(self):
>> self.name
>
>
> ./manage.py sqlall products returns:
>>
>> BEGIN;
>> CREATE TABLE "products_product" (
>> "id" integer NOT NULL PRIMARY KEY,
>> "name" varchar(200) NOT NULL,
>> "desc" text NOT NULL,
>> "pub_date" datetime NOT NULL
>> )
>> ;
>> COMMIT;
>
>
> It's all very simple and nothing is special about what I have done. Sorry in
> advance if you guys have dealt with noob questions like this a hundred
> times.
>

syncdb creates tables in the database if they do not exist.

syncdb does not alter existing tables in the databases.

If you would like to automate the work of altering your database
tables, there is an app called django-south which you can use to
inspect your models and database, and generate migration scripts to
update the database so that it corresponds with your models. Google
knows more about this.

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.



Re: Getting a no such column error when adding data and syncdb is not syncing

2013-01-18 Thread Sergiy Khohlov
python manage.py syncdb

Many thanks,

Serge


+380 636150445
skype: skhohlov


2013/1/18 Nick :
> This is my first django project outside of the tutorials and it's
> frustrating to stumble over something so simple.
>
> I'm getting this error when I try to add a product:
>>
>> DatabaseError at /admin/products/product/add/
>>
>> table products_product has no column named pub_date
>
>
> This is what my models.py file looks like:
>>
>> from django.db import models
>>
>> class Product(models.Model):
>> name = models.CharField(max_length = 200)
>> desc = models.TextField()
>> pub_date = models.DateTimeField()
>>
>> def __unicode__(self):
>> self.name
>
>
> ./manage.py sqlall products returns:
>>
>> BEGIN;
>> CREATE TABLE "products_product" (
>> "id" integer NOT NULL PRIMARY KEY,
>> "name" varchar(200) NOT NULL,
>> "desc" text NOT NULL,
>> "pub_date" datetime NOT NULL
>> )
>> ;
>> COMMIT;
>
>
> It's all very simple and nothing is special about what I have done. Sorry in
> advance if you guys have dealt with noob questions like this a hundred
> times.
>
> --
> 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/-/DL0x4CNUWCAJ.
> 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.



Getting a no such column error when adding data and syncdb is not syncing

2013-01-18 Thread Nick
This is my first django project outside of the tutorials and it's 
frustrating to stumble over something so simple.

I'm getting this error when I try to add a product:

> DatabaseError at /admin/products/product/add/ 
>
> table products_product has no column named pub_date
>
>
This is what my models.py file looks like:

> from django.db import models
>
> class Product(models.Model):
> name = models.CharField(max_length = 200)
> desc = models.TextField()
> pub_date = models.DateTimeField()
>
> def __unicode__(self):
> self.name
>

./manage.py sqlall products returns:

> BEGIN;
> CREATE TABLE "products_product" (
> "id" integer NOT NULL PRIMARY KEY,
> "name" varchar(200) NOT NULL,
> "desc" text NOT NULL,
> "pub_date" datetime NOT NULL
> )
> ;
> COMMIT;
>

It's all very simple and nothing is special about what I have done. Sorry 
in advance if you guys have dealt with noob questions like this a hundred 
times.

-- 
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/-/DL0x4CNUWCAJ.
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: quantize result has too many digits for current context

2013-01-18 Thread Hector Armando Vela Santos
Are you sure that that's the only thing you are doing? have you done 
something before with the prices(preco_unit, valor_total)?? I had once this 
error but was because I was trying to save a decimal field wich exceeded 
the length of the integer part of my decimal field.

On Thursday, January 17, 2013 2:02:14 PM UTC-6, Fellipe Henrique wrote:
>
> Hello,
>
> I have this model:
>
> class ItensPedido(models.Model):
> idvenda_pedido_itens = models.IntegerField(u'Código', 
> primary_key=True, null=False)
> idvenda_pedido = models.ForeignKey('Pedido', 
> db_column='idvenda_pedido', null=False, blank=False)
> idproduto = models.ForeignKey('Produto', db_column='idproduto', 
> verbose_name=u'Produto', null=False, blank=False)
> qnt = models.IntegerField(verbose_name=u'Quantidade', null=False, 
> blank=False, default=1)
> preco_unit = models.DecimalField(u'Preço Unit.', max_digits=12, 
> decimal_places=4, null=False, default=0)
> valor_total = models.DecimalField(u'Vlr. Total', max_digits=12, 
> decimal_places=4, null=False, default=0)
>
> class Meta:
> managed = False
> db_table = 'venda_pedido_itens'
>
>
> and in my template I try to use: {{ form.idpedido }}
>
> but when I`m use this, django show me this error:
>
> quantize result has too many digits for current context
>
> I have lookup the internet and I see some error like this, but always 
> about Decimals fields.. but in my case this error appears in Foreign Key 
> field.
>
> My question is: Why this error appears? How can I fix this?
>
> Thanks for all,
>
> Regards,
> T.·.F.·.A.·. S+F
> *Fellipe Henrique P. Soares*
>
> *"Quemadmodum gladius neminem occidit, occidentis telum est."* (Epistulae 
> morales ad 
> Lucilium, 
> Lucius Annaeus Seneca)
>
> *"Any intelligent fool can make things bigger, more complex, and more 
> violent. It takes a touch of genius -- and a lot of courage -- to move in 
> the opposite direction."* 
> Albert Einstein (March 14th 1879 – April 18th 1955)
>  

-- 
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/-/AT5qAS-uS3oJ.
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: creating tag groups

2013-01-18 Thread Andre Terra
I'd just like to emphasize that django-mptt is *the* way to go. It's one
great application that make it a breeze to work with hierarchies.


Cheers,
AT

On Fri, Jan 18, 2013 at 4:01 AM, Sammael  wrote:

> Amirouche, thank you very much.
> jQuery solution is quite interesting but it's more complicated for me to
> implement. So I think I gonna use your first idea =). django-mptt is very
> simple to install and it's well documented.
> Thank you very much. Your help is inestimable.
>
> среда, 16 января 2013 г., 17:01:21 UTC+4 пользователь Amirouche написал:
>>
>>
>> 2013/1/16 Sammael 
>>
>> Unfortunately, I don't know how it should be. Also I believe your idea of
>>> trees is much simpler and cleaner and thus much better.
>>>
>>> I've installed django-mptt, and it works like a charm. But I'm worried
>>> it would be difficult to upgrade to a new Django version if I use
>>> third-party applications. So I was trying to implement similar approach
>>> using ForeignKey to self, just like django-mptt does:
>>>
>>
>> Sorry, I wasn't clear, I was thinking only thinking about a tree widget
>> not a full blown hierarchical tags which can be indeed a pain.
>>
>>  like the following:
>> - http://www.jstree.com/
>> - 
>> https://github.com/bombino/**jquery-tree-select
>> - 
>> http://code.google.com/p/**jquery-option-tree/
>>
>> at least jquery-tree-select use only one select element in html +
>> javascript, so in python it's just a matter a formatting properly the
>> options:
>>
>> << [...] transforms it into a select box that just shows (none), Category
>> 1, and Category 2. Then when you click on Category 1, a new select box pops
>> up showing Subcategory 1 and Subcategory 2.>>
>>
>> HTH
>>
>>  --
> 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/-/W0NeT7ZwS28J.
>
> 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: Django lucene

2013-01-18 Thread Harry Houdini

I originally went down this path but I too ran into many problems getting 
this to work and ended up using Whoosh instead. The site was small ~30 
pages or so it was still pretty fast. I had it index by reading the sitemap 
and pulling down the page content from the web server. I used 
BeautifulSoup4 to get the page title to store in the Whoosh DB. Anyway, 
just another option to consider.


On Tuesday, August 25, 2009 10:55:59 AM UTC-4, Puneet wrote:
>
> Hi, 
>
> Does anyone have tried django-lucene module for search ?? 
>
> I am able to compile the lucene and jcc as  required but the module is 
> not working properly as it is expected to work.  As mentioned in the 
> docs I have added to fields in my model 
>
>objects = models.Manager() 
>objects_search = Manager() # add search manager 
>
> But when I say ModelName.save() its not getting indexed with lucene 
> and when I say 
>
>  ModelName.objects.objects_search(name_first="Spike") 
>
> I am getting error that 
>
> AttributeError: 'Manager' object has no attribute 'objects_search' 
>
> Can any one help me with this ?? Does anyone have a small working 
> example ? 
>
> Thanks, 
> Puneet 
>

-- 
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/-/Ys0rcBWSMp0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django admin filter foregein key

2013-01-18 Thread Mariano DAngelo
What I'm trying to do is to filter a dropdown list with foregein key, with 
the value of a previus selected dropdown list:

cat_choices = (('AMA','Amateur Mayores'),('AJ','Amateur 
Juveniles'),('AME','Amateur Menores'),('P','Profesional'))

class category(models.Model):
name = models.CharField('Categoria', max_length=30)
gender = models.CharField('Sexo',choices= 
(('M','Masculino'),('F','Femenino')), max_length=1)
type = models.CharField('Tipo',choices=cat_choices , max_length=3)

class boxer (person):
gender = models.CharField('Sexo',choices= 
(('m','Masculino'),('F','Femenino')), max_length=30)
type = models.CharField('Tipo',choices=cat_choices, max_length=30)
category = models.ForeignKey(category)
  

I need to filter categories in boxer admin with the value of gender, and 
type choose in boxer admin I was going to do it with js but I wanted to 
know if the something already done...

thanks

-- 
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/-/GRucdgLpKsMJ.
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: Signal handler not work

2013-01-18 Thread ragsagar
On Fri, Jan 18, 2013 at 12:02 PM, yillkid  wrote:

> But not works, anybody help me ?


Now working means? What exactly happening?
a `Last` object will be created everytime you save the `Info` model object.
If you don't want to do that accept an argument `created` and check if it
is created or already existing object.


-- 
blog : ragsagar.wordpress.com
mail id : python -c "print '@'.join(['ragsagar','.'.join([x for x in
['gmail','com']])])"

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