Re: passing multiple query sets into a url pattern

2012-02-19 Thread Alfredo Alessandrini
mplate. Alfredo 2012/2/19 Stanwin Siow <stanwin.kts...@gmail.com> > Hi Alfredo, > > My apologies for not making my question clear. > > I want to pass two different querysets into the url pattern. Is it > possible? > > Best Regards, > > Stanwin Siow >

Re: passing multiple query sets into a url pattern

2012-02-18 Thread Alfredo Alessandrini
Hi, I'm not sure that I've understand your question: url(r'^profile/(?P\d+)/(?P\d+)$', ..) and now you can use the variable var_1 and var_2 in your function. Alfredo 2012/2/18 Stanwin Siow > Hello, > > I want to find out if there is anyway to pass two

Re: ImportError: No module named profiles

2011-11-10 Thread Alfredo Alessandrini
On Wed, Nov 9, 2011 at 9:27 PM, Alfredo Alessandrini <alfreal...@gmail.com> > wrote: >> >> Hi, >> >> I'm running a script to make a query with django. >> >> I need to run it in crontab. >> >> When I run it I get this error: >> >>

Re: ImportError: No module named profiles

2011-11-10 Thread Alfredo Alessandrini
> Can you show us your script and how you launch it ? > > On Wed, Nov 9, 2011 at 9:27 PM, Alfredo Alessandrini <alfreal...@gmail.com> > wrote: >> >> Hi, >> >> I'm running a script to make a query with django. >> >> I need to run it in cron

ImportError: No module named profiles

2011-11-09 Thread Alfredo Alessandrini
Hi, I'm running a script to make a query with django. I need to run it in crontab. When I run it I get this error: ImportError: No module named profiles I'm using a virtualenv. Thanks, Alfredo -- You received this message because you are subscribed to the Google Groups "Django users"

update database by phpmyadmin

2011-10-23 Thread Alfredo Alessandrini
Hi, I'm trying to import a big database in the django project by phpmyadmin. The import process is successful. The database by phpmyadmin and mysql admin is ok. If I try to make some query by python shell it work. But the problem is that the database isn't showed in the admin panel. (I've

object value distinct for ForeignKey

2011-07-25 Thread Alfredo Alessandrini
Hi, I've a model testDB with a foreignkey "country" related to another database. I need to retrieve the unique value of country.common_name. With this country_list = testDB.objects.values('country').distinct I can retrieve the unique value, but only the ID. In [63]:

odering User in a form

2010-04-27 Thread Alfredo Alessandrini
Hi, I've this model: class Pubblicazioni(models.Model): anno = models.DateField(blank=True, null=True,default=datetime.date.today) autori = models.CharField(max_length=500) titolo = models.CharField(max_length=500) autori_daf = models.ManyToManyField(User) I need to ordering

file upload formset

2010-04-17 Thread Alfredo Alessandrini
Hi, I'm trying to upload a file by a formset. model.py: --- class Person(models.Model): user = models.ForeignKey(User) course = models.TextField(blank=True, null=True) project = models.TextField(blank=True, null=True) CV_ENG = models.FileField(upload_to='upload/CV/',

name in the model

2010-04-15 Thread Alfredo Alessandrini
Hi, I've this model: class Persone(models.Model): CV = models.TextField() Can I change the name "CV" when I display it in a formset? Thanks, Alfredo -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

formset save

2010-04-14 Thread Alfredo Alessandrini
Hi, I've this views.py: I need to save the model of current user. But this don't work. What's wrong? @login_required def profilo(request): from daf.Persone.models import Persone PersoneFormSet = modelformset_factory(Persone, fields=('curriculum_studi'),) utente =

Re: WSGIScriptAlias

2010-04-14 Thread Alfredo Alessandrini
scr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- -- Alfredo Alessandrini, Dr. PhD Department of Environment and Forest

WSGIScriptAlias

2010-04-13 Thread Alfredo Alessandrini
Hi, I've a problem with the apache configuration: I'm trying to set www.example.com/ and www.example.com/test, but if I try this, work only the first site: WSGIScriptAlias / /home/alfreale/. WSGIScriptAlias /test /home/alfreale/. thanks, Alfredo -- You received

save_model admin

2010-04-13 Thread Alfredo Alessandrini
Hi, I've this model: class Person(models.Model): user = models.ForeignKey(User) courses = models.TextField(blank=True, null=True) research_statement = models.TextField(blank=True, null=True) .. I will let to save the form only when the user is making

display user.email in a custom model

2010-03-31 Thread Alfredo Alessandrini
Hi, I've this model: -- class Person(models.Model): user = models.ForeignKey(User) Can I display the user.email or user.first_name in the admin site administration? I try this: --- def __unicode__(self): return u"%s %s" %

search_fields

2009-10-17 Thread Alfredo Alessandrini
Hi, I've this admin.py: from chessemail.GAME.models import Game from django.contrib import admin class GameAdmin(admin.ModelAdmin): list_display = ('id', 'white', 'black', 'time_days_W', 'time_days_B', 'move_game', 'last_move_W', 'last_move_B', 'is_active')

access to id of current user on admin

2009-05-18 Thread Alfredo Alessandrini
Hi, I'm write a model for a post. Can I access to id of current user on admin site? I'm trying with: author = models.ForeignKey(User, default=User.id, blank=True, null=True) But don' work... Thanks, Alfredo -- from django.db import models from

two forms in the same view

2008-12-18 Thread Alfredo Alessandrini
Hi, can I use two form in the same view function? if request.method == 'POST': form = FORM_1(request.POST) if form.is_valid(): . form = FORM_2(request.POST) if form.is_valid(): . It's

Re: django query database

2008-12-14 Thread Alfredo Alessandrini
> Sorry but your question is not clear. Are 'min_rating' and > 'max_rating' fields of the game object ? If yes: Yes It's better: game_list = game.objects.filter(Q(max_rating__gt = player.rating) & Q(min_rating__lt = player.rating)) or game_list =

Re: django query database

2008-12-14 Thread Alfredo Alessandrini
> On Sun, 2008-12-14 at 00:46 +0100, Alfredo Alessandrini wrote: >> Hi, >> >> It's possible call a query with max or min value?: >> >> like this: >> >> game_list = game.objects.filter(Q(max_rating > player.rating) & >> Q(min_rating <

remove object from queryset

2008-12-14 Thread Alfredo Alessandrini
Hi, can I remove an objects from the queryset: In [138]: from CHALLENGE.models import start_game In [139]: start_game.objects.all() Out[139]: [, , ] In [140]: games = start_game.objects.all() In [142]: games Out[142]: [, , ] can I delete the objects with id = 27, for obtain this: In

django query database

2008-12-13 Thread Alfredo Alessandrini
Hi, It's possible call a query with max or min value?: like this: game_list = game.objects.filter(Q(max_rating > player.rating) & Q(min_rating < player.rating)) Thanks in advance, Alfredo --~--~-~--~~~---~--~~ You received this message because you are

forms.ModelChoiceField selected field

2008-12-10 Thread Alfredo Alessandrini
Hi, I've this form: class PlayerForm(forms.Form): challengeable = forms.BooleanField(required=False) show_name = forms.BooleanField(required=False) message_move = forms.BooleanField(required=False) message_confirm = forms.BooleanField(required=False) country =

template tag

2008-12-05 Thread Alfredo Alessandrini
Hi, I've this variable in my template: {{ challenger.rating }} It'a a number... Can I calculate a sum like this: {{ challenger.rating }} + 200 ?? I must write a custom tag? Alfredo --~--~-~--~~~---~--~~ You received this message because you are

forms.ModelMultipleChoiceField

2008-12-02 Thread Alfredo Alessandrini
Hi, I've set the player form with: class PlayerForm(forms.Form): challengeable = forms.BooleanField(required=False) show_name = forms.BooleanField(required=False) country = forms.ModelMultipleChoiceField(queryset=Country.objects.all()) and the template with: I've a problem to

ordering by models.ForeignKey

2008-11-30 Thread Alfredo Alessandrini
Hi, I've this model: class Player(models.Model): user = models.ForeignKey(User, blank=True, null=True) country = models.ForeignKey(Country) If I try to ordering Player by "user", don' work: Player.objects.order_by("user") I want ordering Player by user.username Alfredo

checkbox and BooleanField

2008-11-15 Thread Alfredo Alessandrini
Hi, I've this template: And this View: class MoveGameForm(forms.Form): resign = forms.BooleanField(required=False) draw = forms.BooleanField(required=False) move = forms.BooleanField(required=False) I'm writing the view, with:

User.email

2008-10-31 Thread Alfredo Alessandrini
Hi, I've this model: from django.contrib.auth.models import User class Player(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=40) email = models.EmailField() user = models.ForeignKey(User, blank=True, null=True) I try to set

ifequal and numbers

2008-10-27 Thread Alfredo Alessandrini
There is a method for write this, without write a loop: {% ifequal apple.number <20 %} .. {% endifequal %} Alfredo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: customize auth.users

2008-10-27 Thread Alfredo Alessandrini
rib.auth. > > Erik > > > On 27.10.2008, at 12:52, Alfredo Alessandrini wrote: > >> >> I've solve whit this: >> >> http://wolfram.kriesing.de/blog/index.php/2008/customize-admin-for-user-model >> >> >> Alfredo >> >> 2008/10/27 Alf

Re: customize auth.users

2008-10-27 Thread Alfredo Alessandrini
I've solve whit this: http://wolfram.kriesing.de/blog/index.php/2008/customize-admin-for-user-model Alfredo 2008/10/27 Alfredo Alessandrini <[EMAIL PROTECTED]>: > Can I customize the auth.users list of the site administration? I need > to display also the active status in the list

customize auth.users

2008-10-27 Thread Alfredo Alessandrini
Can I customize the auth.users list of the site administration? I need to display also the active status in the list. Thanks, Alfredo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: modelForm

2008-10-14 Thread Alfredo Alessandrini
I've a new error :-) : File "./mysite/views.py", line 26, in setup_player return render_to_response('player_form.html', {'form': form}) UnboundLocalError: local variable 'form' referenced before assignment 2008/10/14 Daniel Roseman <[EMAIL PROTECTED]>: > > On Oct

Re: modelForm

2008-10-14 Thread Alfredo Alessandrini
else: form = ContactForm() # An unbound form return render_to_response('contact.html', { 'form': form, }) -- I don't understand where is the difference... Alfredo 2008/10/14 Steve Holden <[EMAIL PROTECTED]>: >

modelForm

2008-10-14 Thread Alfredo Alessandrini
I've setup a form from a model: class PlayerForm(ModelForm): class Meta: model = Player I've setup a view function for save the data inserted in the form: def setup_player(request): if request.method == 'POST': form = PlayerForm(request.POST) if form.is_valid():

Re: static html

2008-10-13 Thread Alfredo Alessandrini
ok...it's work. but If I want customize the url by url.py? Alfredo 2008/10/13 Daniel Roseman <[EMAIL PROTECTED]>: > > On Oct 13, 12:12 pm, "Alfredo Alessandrini" <[EMAIL PROTECTED]> > wrote: >> > First of all, why don't you just point the browser a

Re: static html

2008-10-13 Thread Alfredo Alessandrini
> First of all, why don't you just point the browser at the URL of the > commands.html file in the first place? at the URL? In urls.py? Alfredo >> 2008/10/8 Alfredo Alessandrini <[EMAIL PROTECTED]>: >>> Hi, >>> >>> I'm trying to sho

Re: form fields

2008-10-10 Thread Alfredo Alessandrini
: > > class Game(Model): > # ... > time_days_W = CharField(max_length=128, verbose_name="time") > > 2008/10/10 Alfredo Alessandrini <[EMAIL PROTECTED]> >> >> Hi, >> >> I've create a model form by: >> >> class GameForm(ModelForm):

form fields

2008-10-10 Thread Alfredo Alessandrini
Hi, I've create a model form by: class GameForm(ModelForm): class Meta: model = Game fields = ('white', 'black', 'time_days_W', 'inc_time') and the form template: {{ form.as_p }} The view function is ok, but I want to change the label of a field. I want to change

Re: static html

2008-10-08 Thread Alfredo Alessandrini
I've solved it with: def list_commands(request): commands = open('home/.../commands.html') return HttpResponse(commands) commands.close() 2008/10/8 Alfredo Alessandrini <[EMAIL PROTECTED]>: > Hi, > > I'm trying to show a static html page... > > The html

static html

2008-10-08 Thread Alfredo Alessandrini
Hi, I'm trying to show a static html page... The html page is in the /media folder. I've some problem with view funcition: def list_commands(request): commands = return HttpResponse(commands) How can I load the html page? Regards, Alfredo

Re: change a value of database

2008-07-16 Thread Alfredo Alessandrini
solved... from GAME.models import Game p = Game.objects.get(id=1) p.name = '2' p.save() --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

change a value of database

2008-07-16 Thread Alfredo Alessandrini
I've a simple a question... How can I update a single value of database?? I've try this: from GAME.models import Game Game.objects.filter(id=1) p.name='2' but don't update...It's add a row. thanks in advance, Alfredo --~--~-~--~~~---~--~~ You received

working with database

2008-07-15 Thread Alfredo Alessandrini
I must select a column from my database. I've try with: from PLAYER.models import Player player = Player.objects.all() email = Player.objects.values('email') ok, work fine, but in the Django Book I read: "This method is useful when you know you're only going to need values from a small number

delete or update a model

2008-07-15 Thread Alfredo Alessandrini
Hi, How can I update or delete a model? Alfredo --~--~-~--~~~---~--~~ 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

hosting web

2008-02-09 Thread Alfredo Alessandrini
Hi, I'm a beginner about django. I've a doubt. How I can verify if an hosting web can support django? If it support python is sure that django work? thanks, Alfredo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

web site

2007-09-02 Thread Alfredo Alessandrini
I'm a newby..:-) Is Django good for make a web site like this? http://www.ficgs.com/ http://www.chessmail.org/ These are a web site for playing correspondence chess. The moves are stored with a database, with information about the players, tournament, rating, ecc.. Alfredo