Re: SOLUTION FounD : How to restore Models original Properties - Problem in Models column Exclude

2019-05-31 Thread Alexis Roda
wn in the django docs[1]. The point is that neither of those solutions makes changes to shared state (the admin). HTH [1] https://docs.djangoproject.com/en/1.11/ref/contrib/admin/ Missatge de Balaji Shetty del dia dv., 31 de maig 2019 a les 16:42: > Dear Alexis Roda Sir > > Thank You v

Re: Model Forms Dynamic

2019-05-28 Thread Alexis Roda
Something like that? def model_form_factory(model_class): class MyModelForm(forms.ModelForm): class Meta: model = model_class return MyModelForm AuthorForm = model_form_factory(Author) BookForm = model_form_factory(Book) Missatge de Yoo del dia dt., 28 de maig 2019

Re: SOLUTION FounD : How to restore Models original Properties - Problem in Models column Exclude

2019-05-28 Thread Alexis Roda
No, it isn't. It's not thread safe. Changes in shared state in multi-threaded code may lead to race conditions[1]. Depending on your usage it may be very unlikely, but under the right circumstances root may end up having some missing fields in the form or dgp may see fields that it is not intende

Re: Single place for validation

2019-05-27 Thread Alexis Roda
Hi, an approach that comes to mind would be defining validation in the model and using model forms[1] for the user site. HTH [1] https://docs.djangoproject.com/en/2.2/topics/forms/modelforms/ Missatge de Harsh Gundecha del dia dl., 27 de maig 2019 a les 16:20: > hello, > i am currently learni

Re: How to restore Models original Properties - Problem in Models column Exclude

2019-05-27 Thread Alexis Roda
Not an admin expert here. You are modifying the modeladmin instance and, by the behavior you're describing, it looks like it is a global (shared) object. I'm guessing, you can confirm this by printing id(self) in add_view(). I'll bet you get the same value in each request, so the instance is share

Re: Trouble upgrading ModelField class for django 1.10

2017-06-03 Thread Alexis Roda
El 03/06/17 a les 16:27, Simon Charette ha escrit: Hello Alexis, As you've noticed Django 1.8 changed values()/values_list() to converts values returned from the database just like any other ORM method[0]. If you want to use the json module to serialize your horari.Horari instances you'll ha

Trouble upgrading ModelField class for django 1.10

2017-06-03 Thread Alexis Roda
Hi, I have a custom ModelField (HorariField, a simple weekly timetable) written for django 1.7 and I'm trying to upgrade it to work with django 1.10, so I have removed the SubfieldBase metaclass and added the from_db_value method. The field inherits from CharField and stores Horari instances

Re: Problems receiving data from DB (sqlite3)

2013-04-07 Thread Alexis Roda
Al 07/04/13 22:50, En/na Johannes ha escrit: yea, my knowledge from python is like larry and you told, the pyc-files get rebuild if the timestamp of the py and pyc files differs. But, because in my case it seems to be handled different, I wondered if django handles this in another way. I'm not

Re: Problems receiving data from DB (sqlite3)

2013-04-07 Thread Alexis Roda
Al 07/04/13 21:35, En/na Johannes ha escrit: I get again to different results. the shell accesses the settings.py while from the testserver the settings.pyc is accessed. After I deleted the pyc-file. the testserver uses the settings.py too. When and in which cases the pyc-file gets (re)-build?

Re: Problems receiving data from DB (sqlite3)

2013-04-07 Thread Alexis Roda
Al 07/04/13 20:35, En/na Johannes ha escrit: In order to diagnose what the problem really is I'd suggest to add a print to some of your views: databases {'default': {'ENGINE': 'django.db.backends.sqlite3', 'TEST_MIRROR': None, 'NAME': ':memory:', 'TEST_CHARSET': None, 'TIME_ZONE': 'UTC', 'TEST_

Re: Problems receiving data from DB (sqlite3)

2013-04-04 Thread Alexis Roda
Al 03/04/13 19:38, En/na Johannes ha escrit: Hi list, I have a confusing behaviour when I try to access some data in the DB. I created a model and build the database with syncdb. I can create and save data via python manage.py shell and it's still available after I a restart of the shell. But thi

Re: djano user registration form and login(full example)

2013-04-01 Thread Alexis Roda
Al 01/04/13 21:11, En/na sachin ha escrit: Hello, I'm just starting with Django. I want to create a user registration form which will take input like username, password, first and last name, email, address etc. using the same information I want to send a conformation mail to user and authenticat

Re: Using Django docs to find widget readonly specification

2013-03-31 Thread Alexis Roda
Al 31/03/13 23:42, En/na AJP ha escrit: I'm new to learning Django. I want to find the documentation regarding the readonly attribute you can set for admin widgets. Do you mean? https://docs.djangoproject.com/en/1.5/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields It's link

Re: how do I specify optional params in url?

2013-03-31 Thread Alexis Roda
Al 31/03/13 22:43, En/na frocco ha escrit: Thank you for taking the time to help me. You're welcome. One last thing. I'm not a native english speaker, so if I sound rude it's not my intention. That said ... When you ask for help in the list try to include more information: the error messag

Re: how do I specify optional params in url?

2013-03-31 Thread Alexis Roda
Al 31/03/13 21:55, En/na frocco ha escrit: I am kinda lost with url encoding being a newbie in django. I do not see my error. Can you give me an example? Here it is: views.py: def my_view(request, foo, bar="spam"): pass urls.py # choose descriptive names for the views ..

Re: how do I specify optional params in url?

2013-03-31 Thread Alexis Roda
El diumenge 31 de març de 2013 21:01:55 UTC+2, frocco va escriure: > > url(r'^narrow_category/(\d+)/$', 'catalog.views.narrow_category', > name="narrow_category"), > url(r'^narrow_category/(\d+)/(\w+)/$', > 'catalog.views.narrow_category', name="narrow_category"), > url(r'^narr

Re: how do I specify optional params in url?

2013-03-31 Thread Alexis Roda
Al 31/03/13 21:01, En/na frocco ha escrit: url(r'^narrow_category/(\d+)/$', 'catalog.views.narrow_category', name="narrow_category"), url(r'^narrow_category/(\d+)/(\w+)/$', 'catalog.views.narrow_category', name="narrow_category"), url(r'^narrow_category/(\d+)/(\w+)/(\d+)/$', '

Re: how do I specify optional params in url?

2013-03-31 Thread Alexis Roda
Al 31/03/13 19:00, En/na frocco ha escrit: Hello, Here is my current url. url(r'^narrow_category/(\d+)/(\w*)/(\d*)/(\d*)/(\d*)/$', 'catalog.views.narrow_category', name="narrow_category"), d+ is required w* can be optional last three d* can be optional This setting is not working. You s

Re: How do I get these field values in my template?

2013-03-31 Thread Alexis Roda
Al 31/03/13 15:18, En/na frocco ha escrit: cat = Product.objects.values_list('category__image_path','category__id') outputs; (u'category/goodyear logo.jpg', 13) I tried for c in cat: c.image_path c.id As its name may suggest values_lists() returns (kind) a list of lists, so you must index by

Re: Doubt regarding JSON/SQL in Django

2013-03-30 Thread Alexis Roda
Al 30/03/13 19:25, En/na Parin Porecha ha escrit: Yes, I meant the former ( managing presentation on the client ). Also, considering that a user might have as many as 100 - 200 tasks in one JSON file ( their description, dates, tags and all ), is it better performance wise ? The responsiveness

Re: Doubt regarding JSON/SQL in Django

2013-03-30 Thread Alexis Roda
Al 30/03/13 16:41, En/na Parin Porecha ha escrit: Thanks ! Okay, so i am dropping the idea of using JSON for storage. So, if I use JSON only as a format to send data to client ( All the parsing will be done client side ), is it better than using {{ task.name }}, {{ task.start_date }} ? ( Sorry

Re: Doubt regarding JSON/SQL in Django

2013-03-30 Thread Alexis Roda
Al 30/03/13 14:37, En/na Parin Porecha ha escrit: Also, would it be beneficial performance wise ? It depends on how you implement it: * on a "traditional" client/server application I think that loading/parsing/processing/encoding/saving the json file on each request will be very expensive co

Re: Doubt regarding JSON/SQL in Django

2013-03-30 Thread Alexis Roda
Al 30/03/13 14:14, En/na Parin Porecha ha escrit: Hi, I have just started using Django. I want to create a to-do task manager application. Users would register, login and can work with their tasks. So, instead of creating a table in the database for each user, I want to create a JSON file for ea

management commands in namespaced apps

2013-03-28 Thread Alexis Roda
Hi all, I'm having a hard time making management commands defined in a namespaced app available to "manage.py". I have a namespace python package "dja.skel.core" that provides some functionality and a namespace app "dja.skel.django_skel" which defines functionality specific to django, a manag

Re: 发生了什么,

2012-09-27 Thread Alexis Roda
Al 27/09/12 10:10, En/na Huahui Zhou ha escrit: http://stackoverflow.com/questions/6778638/manage-py-runserver-error-errno-10013 -- 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.c

Re: httplib exception in Django model

2012-09-19 Thread Alexis Roda
Al 19/09/12 10:42, En/na airween ha escrit: File "/usr/lib/python2.6/socket.py", line 547, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): error: Int or String expected >>> What should I do, what is the problem? According to the last line it seems that 'host

Re: Hard time debugging an strange problem

2012-08-31 Thread Alexis Roda
Al 31/08/12 18:26, En/na Tomas Neme ha escrit: I'd like to see some of your management commands' code. It smells somewhat like you're running a shell subprocess and not waiting for it to be done before going on to the next thing Thanks for taking the time to answer. I've thought on this. On

Re: Hard time debugging an strange problem

2012-08-31 Thread Alexis Roda
Hi again, doing some more testing I've realized that the problem happens because the .py and .pyc files are out of sync. My guess is that the .py files are modified so quickly that the timestamp does not change and a recompilation is not triggered. After some research I've found that the times

Hard time debugging an strange problem

2012-08-30 Thread Alexis Roda
Hi all, sorry for the ambiguous subject, but I can't summarize it in a few words. This is my first message to the list asking for help so I think that is polite to give a big thanks to those of you that are making developing with django such a great pleasure. This is a great community. Said t

Re: SyntaxError Creating New Project

2012-08-22 Thread Alexis Roda
Al 22/08/12 23:00, En/na Bestrafung ha escrit: I'm new to Django and though I've dabbled with Linux off and on for a decade I'm still learning so please go easy on me. I'm following this guide to

Re: HttpResponseNotModified returning 200 code

2012-08-22 Thread Alexis Roda
Al 22/08/12 21:36, En/na Kevin Anthony ha escrit: Here is my code: id = get_id(request) if id is not None: host = request.GET['host'] if host!=None: command = command_queue.objects.all().filter(destination_hostname=host,user__id=id) if not co

Re: Updating a model instance with extra checks.

2012-08-20 Thread Alexis Roda
Al 20/08/12 18:53, En/na Sebastien Flory ha escrit: Hi everyone, I'm looking for the proper django way to do an update of an attribute on my model instance, but only if the attribute current value is checked agains't a condition, in an atomic way, something like this: def use_money(self, value)

Re: Problem with the urls.py "unexpected end of pattern"

2012-08-17 Thread Alexis Roda
I think that this is not the problem because I can access to volunters without problems. I have problems only with admin, organizers and events paths. So you have problems with all the urls past the first with a wrong pattern. ~$ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.

Re: Problem with the urls.py "unexpected end of pattern"

2012-08-17 Thread Alexis Roda
Al 17/08/12 17:42, En/na Rafael Romero Carmona ha escrit: Hi, I'm learning Django and I have problems with the urls.py. I show you how that's writed: from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('users.views',

Re: Adding Button in admin form

2012-08-17 Thread Alexis Roda
Al 17/08/12 13:05, En/na Madhu ha escrit: Yes, That's right. I tried to change the admin form, but the button is not added. the fuctionality Jani Tiainen said i want the same fuctionality, but the now first problem is adding button in change form. As Jani has pointed I think that a custom widge

Re: installing django extensions

2012-08-16 Thread Alexis Roda
Al 16/08/12 19:16, En/na Sells, Fred ha escrit: Thanks, that last post was the clue I needed. I have 2 independent, active django projects and was erroneously editing the settings.py in the wrong project. Just plain old stupid error, but I may have not seen it for days without all your help.

Re: installing django extensions

2012-08-16 Thread Alexis Roda
Al 16/08/12 17:20, En/na Sells, Fred ha escrit: It seems to import OK, see below: more manage.bat \alltools\python26\python manage.py %1 %2 %3 %4 %5 C:\all\projects\AccTherapySchedulerServer\AccTherapySite>manage shell C:\all\projects\AccTherapySchedulerServer\AccTherapySite>\alltools\python2

Re: installing django extensions

2012-08-16 Thread Alexis Roda
Al 16/08/12 15:23, En/na Sells, Fred ha escrit: C:\alltools\python26>python Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >> import django_extensions >> dir(django_extensions)

Re: 'bool' object has no attribute 'render'

2012-08-15 Thread Alexis Roda
Al 15/08/12 02:59, En/na yao ge ha escrit: class NewsAdmin(admin.ModelAdmin): list_display = ('title','newstype','newsdate',) search_fields=('title',) list_filter =('newstype',) delete_selected_confirmation_template = True raw_id_fields = ('rateperson','ratetvplay',) admi

Re: Not reading from TEMPLATE_DIRS in settings.py

2012-08-14 Thread Alexis Roda
Al 14/08/12 12:50, En/na madala ha escrit: So I carried on and started tutorial 3 till I got halfway down and had to do same thing but no matter what I try can't get Django to recognize my directories. Can anyone see where I am going wrong please? thanks in anticipation. What error are you ge

Re: Added wiring for basic authentication?

2012-08-11 Thread Alexis Roda
Al 11/08/12 19:48, En/na Jonathan Hayward ha escrit: I have a Django project with the root view @login_required, and I'm not sure how to populate /accounts so that that heirarchy will hangle login-related information. The Django Book at https://docs.djangoproject.com/en/dev/topics/auth/ seems to

Re: how to organize models

2012-08-11 Thread Alexis Roda
Al 11/08/12 15:57, En/na Jojo ha escrit: Hi, I'm developing my first web application with Django. The model is growing up quite fast and I started to split the code in different files I putted under models directory with its __init__.py file. Everything works fine, but syncdb doesn't recognize ne

Re: edit a submitted form-load it on template

2012-08-07 Thread Alexis Roda
Al 07/08/12 14:04, En/na mapapage ha escrit: $(document).ready(function () { $("a").on("click", function(event) { event.preventDefault(); var id = $(this).attr("id"); $.get("edit_wreqs"+"/"+id+"/", function(data) { }); }); }); Disclaimer: I don't use jquery myself. My response is based on my

Re: named url patterns - invalid syntax

2012-08-05 Thread Alexis Roda
Al 05/08/12 13:43, En/na Blaxton ha escrit: Hi Why following line cause an invalid syntax : (r'^myform/$', 'mysite.views.myform', name="myform"), Because it's syntax is invalid: the 'name=value' is allowed in function calls but not in tuples. Try with: urlpatterns = patterns('', url(r

Re: Strange query string/doubled value?

2010-09-19 Thread Alexis Roda
En/na Benjamin Buch ha escrit: 1: Pass the ValueError like this: if 'picture' in request.GET: try: pictures.insert(0, pictures.pop(int(request.GET['picture']) -1)) except IndexError: pass except ValueError: pass As a rule of thumb

Re: enumerating view functions

2010-06-16 Thread Alexis Roda
En/na Dmitry Beransky ha escrit: Hi, Is there a way to enumerate view functions that are currently associated with a url patern? In the end, I'd like to get a list of triples: pattern name, pattern, callback function. If you want to get a dump of the (regex, view, name) triples on the screen