How to update data without using the API

2021-11-12 Thread Antonio Stan
Hey, so i have 2 models, one for cars and one for transactions. I would 
appreciate if anyone could help me. When i create a transaction, i need to 
update the sum of prices in the cars model (i have a foreignkey allocated 
to cars id which goes into the transaction). So, how could i update the sum 
while using the transaction viewset(aka posting/deleting/etc.)

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7b8f230e-10fe-4dc1-a9a0-0b709fc7c87cn%40googlegroups.com.


Re: Problem re-rendering ClearableFileInput on validation error

2021-10-08 Thread Jesus Antonio Sv
Did you find a solution for this?

On Saturday, December 12, 2020 at 1:13:39 AM UTC+9 michael@gmail.com 
wrote:

> Note that if the user decides to upload a new file on step 2, the field 
> will then be re-rendered with the uploaded file object, which also ends up 
> rendering a blank file input. Is there a case where FileField.bound_data() 
> should return anything else than the initial value?
>
>
>
> On Fri, Dec 11, 2020 at 10:36 AM Michael Goffioul  
> wrote:
>
>> When a form containing a ClearableFileInput is re-rendered (e.g. due to 
>> validation error of some other field), and the clear checkbox was checked 
>> on the first submit, the widget is rendered without initial value, as empty 
>> file input.
>>
>> For instance, let's says there's a model with ImageField and all the 
>> form/view mechanics to edit the model. You edit a model instance that has 
>> an uploaded image already:
>> 1. on initial render, the field is rendered with the clear checkbox and 
>> link to existing file
>> 2. submit the form with some invalid data (e.g. there's another field in 
>> the form that does not validate)
>> 3. on re-render, the field is rendered as empty file input, without clear 
>> checkbox and link
>>
>> AFAICS, this is because:
>> - ClearableFileInput.value_from_datadict() returns False
>> - FileField.bound_data() returns False: it only returns initial data if 
>> submitted data is None or FILE_INPUT_CONTRADICTION
>> - BoundField.value() returns False
>> - BoundField.as_widget() renders field with value set to False
>>
>> I find it non-intuitive that the field is re-rendered as blank, as if 
>> there was no initial data. Is this the intended behavior? Or am I missing 
>> something?
>>
>> Michael.
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/4133479d-8781-48d5-9e13-8080504a5749n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8e4e4169-44e1-4fbd-9b4c-ab87a4056fe4n%40googlegroups.com.


Azure Analysis services with Django

2020-11-22 Thread Antonio Krsnik
Hi there,

I am new to this so hope someone can help me.
I want to use tabular model from Azure Analysis services my company has as 
a data source with Django. Has anyone tried it and can help me? Also, if I 
understood correctly, migrations will also apply changes to database, but I 
just want to read from it and prevent any alterations.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f4b45f36-58c5-4e8e-b082-aba688d7e20dn%40googlegroups.com.


Interfaz Gráfica (Frontend)

2020-04-17 Thread Denilson Antonio Avellan
Hola comunidad estoy empezando con Django me parece super genial pero 
quiero empezar con las interfaces gráficas por ejemplo necesito ejemplos o 
plantillas de login. menus. vistas etc. y queria saber en que me pueden 
ayudar mandandome links donde me pueda guiar! 

Muchas Gracias..!!

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/df15c69c-d84f-45b9-9663-37d6b4b9ae69%40googlegroups.com.


Re: Models as choices

2020-04-17 Thread Denilson Antonio Avellan
me pueden enviar el codigo completo ? para hacer un login solo la
interfqaz grafica sin nada de conexion a base de datos porfavor!

El vie., 17 de abr. de 2020 a la(s) 00:00, Gavin Wiener (
gavinwie...@gmail.com) escribió:

> If you're serializing as JSON, that primary key is literally just integer
> then, and the foreign key relationship requires an instance of that foreign
> key. So you'll need to fetch an instance of the object first.
>
> I've had this issue before, that's how I resolved it.
>
> On Friday, April 17, 2020 at 1:51:05 PM UTC+8, shreehari Vaasistha L wrote:
>>
>> i get this error when trying in your way:
>>
>> Cannot assign "2": "User.highest_degree" must be a "Degree" instance.
>>
>> On Thursday, April 16, 2020 at 5:31:07 PM UTC+5:30, Gavin Wiener wrote:
>>>
>>> Couldn't the User just have a ForeignKey on countries?
>>>
>>> On Thursday, April 16, 2020 at 12:52:07 PM UTC+8, shreehari Vaasistha L
>>> wrote:

 how can i use model x values as choices for model y ?

 for eg:
 class countries(models.Model):
  country = models.CharField(max_length=200)

  def __str__(self):
  return self.country

 class User(AbstractUser):
  """User model."""

  username = None
  full_name = models.CharField(_("Full Name"), max_length=50, default="Full
 Name")
  country_choices = models.CharField(choices=countries

>>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c563335e-cd3f-4204-9aec-6c098dc3a525%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALVb5jEr-MnU7Z_6x%2BD30RrHGT4zBVSCsRGK4eGpikLXR%2BRQow%40mail.gmail.com.


Re: pip install mysqlclient not working

2020-01-01 Thread Antonio Alvarez Ramirez
Hello !!

Try to install MySQL connector

https://dev.mysql.com/downloads/connector/cpp/

Happy new year!!


El mié., 1 ene. 2020 13:00, Mohd Akram  escribió:

> i am using python 3.8 and django 1.11.22
>
> PS C:\WINDOWS\system32> *pip install mysqlclient*
> Collecting mysqlclient
>   Using cached
> https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz
> Installing collected packages: mysqlclient
> Running setup.py install for mysqlclient ... error
> ERROR: Command errored out with exit status 1:
>  command:
> 'c:\users\admin\appdata\local\programs\python\python38-32\python.exe' -u -c
> 'import sys, setuptools, tokenize; sys.argv[0] =
> '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-olk1oy74\\mysqlclient\\setup.py'"'"';
> __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-olk1oy74\\mysqlclient\\setup.py'"'"';f=getattr(tokenize,
> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
> install --record
> 'C:\Users\Admin\AppData\Local\Temp\pip-record-gq4a004x\install-record.txt'
> --single-version-externally-managed --compile
>  cwd:
> C:\Users\Admin\AppData\Local\Temp\pip-install-olk1oy74\mysqlclient\
> Complete output (30 lines):
> running install
> running build
> running build_py
> creating build
> creating build\lib.win32-3.8
> creating build\lib.win32-3.8\MySQLdb
> copying MySQLdb\__init__.py -> build\lib.win32-3.8\MySQLdb
> copying MySQLdb\_exceptions.py -> build\lib.win32-3.8\MySQLdb
> copying MySQLdb\compat.py -> build\lib.win32-3.8\MySQLdb
> copying MySQLdb\connections.py -> build\lib.win32-3.8\MySQLdb
> copying MySQLdb\converters.py -> build\lib.win32-3.8\MySQLdb
> copying MySQLdb\cursors.py -> build\lib.win32-3.8\MySQLdb
> copying MySQLdb\release.py -> build\lib.win32-3.8\MySQLdb
> copying MySQLdb\times.py -> build\lib.win32-3.8\MySQLdb
> creating build\lib.win32-3.8\MySQLdb\constants
> copying MySQLdb\constants\__init__.py ->
> build\lib.win32-3.8\MySQLdb\constants
> copying MySQLdb\constants\CLIENT.py ->
> build\lib.win32-3.8\MySQLdb\constants
> copying MySQLdb\constants\CR.py ->
> build\lib.win32-3.8\MySQLdb\constants
> copying MySQLdb\constants\ER.py ->
> build\lib.win32-3.8\MySQLdb\constants
> copying MySQLdb\constants\FIELD_TYPE.py ->
> build\lib.win32-3.8\MySQLdb\constants
> copying MySQLdb\constants\FLAG.py ->
> build\lib.win32-3.8\MySQLdb\constants
> running build_ext
> building 'MySQLdb._mysql' extension
> creating build\temp.win32-3.8
> creating build\temp.win32-3.8\Release
> creating build\temp.win32-3.8\Release\MySQLdb
> C:\Program Files (x86)\Microsoft Visual
> Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x86\cl.exe /c
> /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,4,6,'final',0)
> -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C
> 6.1\include\mariadb"
> -Ic:\users\admin\appdata\local\programs\python\python38-32\include
> -Ic:\users\admin\appdata\local\programs\python\python38-32\include
> "-IC:\Program Files (x86)\Microsoft Visual
> Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program
> Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files
> (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files
> (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files
> (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files
> (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files
> (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /TcMySQLdb/_mysql.c
> /Fobuild\temp.win32-3.8\Release\MySQLdb/_mysql.obj /Zl
> /D_CRT_SECURE_NO_WARNINGS
> _mysql.c
> MySQLdb/_mysql.c(29): *fatal error C1083: Cannot open include file:
> 'mysql.h': No such file or directory*
> *error: command 'C:\\Program Files (x86)\\Microsoft Visual
> Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x86\\cl.exe'
> failed with exit status 2*
> 
> ERROR: Command errored out with exit status 1:
> 'c:\users\admin\appdata\local\programs\python\python38-32\python.exe' -u -c
> 'import sys, setuptools, tokenize; sys.argv[0] =
> '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-olk1oy74\\mysqlclient\\setup.py'"'"';
> __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-olk1oy74\\mysqlclient\\setup.py'"'"';f=getattr(tokenize,
> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
> install --record
> 'C:\Users\Admin\AppData\Local\Temp\pip-record-gq4a004x\install-record.txt'
> --single-version-externally-managed --compile Check the logs for full
> command output.
>
> --
> You received this message because you 

Re: I'm getting a NewConnectionError while using reqeusts.

2019-12-22 Thread Antonio Alvarez Ramirez
Hello ,

You add four  !!! ;-) try yo remove one

Bye , and have nice day

El dom., 22 dic. 2019 8:55, Aaryan Dewan  escribió:

> I was making a simple django application in which it will lookup to
> google.com and display all the links. Here's some of the code( that's
> causing the error ):
>
> from django.shortcuts import render, HttpResponse
> import requests
> from bs4 import BeautifulSoup
>
> def scrape(request):
>
> page = requests.get('https://.google.com')
> soup = BeautifulSoup(page.text, 'html.parser')
> ...
>
> When I try to run the local Django server and open localhost:8000 I get
> this error:
>
> *ConnectionError at / *
>
> *HTTPSConnectionPool(host='.google.com ',*
> *port=443): Max retries exceeded with url: / (Caused by*
> *NewConnectionError(' *at 0x056BFB50>: Failed to establish a new connection: [Errno 11001]*
> *getaddrinfo failed'))*
>
> On the other hand, if I try running `page = requests.get("
> https://www.google.com;)` on a python shell in the command prompt, it
> works fine with no errors.
>
> I tried to use `time.sleep` as it was mentioned in some SE answer but that
> did not help. So how should I go about fixing this?
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7353725f-ae5c-4756-9cf3-67e1e1dfc449%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMuDJBKzwz2RrWRfmft5hChSH_VhXpLNYy0WKWDBu8Ny5xQCsw%40mail.gmail.com.


Re: Power BI integration with django

2019-11-27 Thread Antonio CG
ty

El miércoles, 27 de noviembre de 2019, 19:39:04 (UTC+1), Integr@te System 
escribió:
>
> Hi friend,
>
> Blessing u:
>
> powerBI rest API:
> https://docs.microsoft.com/en-us/rest/api/power-bi/embedtoken
>
> Ironpython integrated .Net:
> https://ironpython.net/
>
> On Wed, Nov 27, 2019, 22:21 Brian > 
> wrote:
>
>> Does anyone know how to integrate a Power BI dashboard with a web page, 
>> without the user having to log in to the power BI account
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/e807c75c-e976-4ec3-8389-5a5011aaecf2%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/92b495c4-79be-4fd2-9feb-c367017c1c5a%40googlegroups.com.


Is a bug when renaming a model which has a Foreign Key?

2019-10-25 Thread Luis Antonio Chapado Chorro
I want to rename a model. 

>From "BaseSpaceLibraryName" to "LibraryKit"

class *LibraryKit* (models.Model):
libraryName = models.CharField(max_length=125)
generatedat = models.DateTimeField(auto_now_add=True)

class Projects(models.Model):
LibraryKit_id = models.ForeignKey(
*LibraryKit*,
on_delete=models.CASCADE , null=True)

When running the makemigrations I confirm that model is renamed,
and I get the following code on the migrations file

# Generated by Django 2.2 on 2019-10-24 20:20

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('wetlab', '0105_auto_20191017_2257'),
]

operations = [
migrations.RenameModel(
old_name='BaseSpaceLibraryName',
new_name='LibraryKit',
),
]

However when running the migrate command , no SQL commands are created, and 
I get this error:
ValueError: The field wetlab.Projects.LibraryKit_id was declared with a 
lazy reference to 'wetlab.basespacelibraryname', but app 'wetlab' doesn't 
provide model 'basespacelibraryname'.

Even if a "fake" this change, next time  I execute "migrate"  (without any 
change in the models) I get the same error.

The only way I solved it, was to make a fake-initial an doing manually 
changes on MySQL.

Searching at similar issue at internet, what I get in the migration file is 
ok.

So I asking if it is a bug in the code ? Or there is something I am doing 
wrong?
I am using the django version 2.2.6 

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/662442b9-5a94-4d14-90b1-6ebaa0c9f271%40googlegroups.com.


Re: Looking for an experienced Django full stack developer

2019-02-27 Thread Antonio José Brasil
Hello!

I'm interested.
Tell me more.

Antonio.
antoniojppr...@gmail.com


Em ter, 26 de fev de 2019 às 07:02, Giorgio M.  escreveu:

> We are looking to expand our team with an experienced Python / Django
> developer, with the ability to work vertically from the model creation to
> the frontend (on a bootstrap template and jQuery). Remote position,
> possibly full time. Please contact me if interested.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e86399fb-0a17-493a-8cdd-2afcabf8e20f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e86399fb-0a17-493a-8cdd-2afcabf8e20f%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADbsZPD7GoeyDd%2BZL-ys%3DpJUxR%3DEGZUQNwZu3hgwuRTPKcJo%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


NavBar - Data presentation in next column

2019-02-22 Thread Antonio José
Hello!

In vertical NavBar, how to presentation the list of data, in next column 
and first row. 

Example:
https://dpaste.de/Zu1t#L10

Thanks.

Antonio

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ce7c869f-e65d-4bac-a5dd-e379a75f5603%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django doesn't run manage.py: ModuleNotFoundError: No module named 'ProjectName' (clonded Django project))

2018-11-27 Thread Marco Antonio Diaz Valdes


Hello, my partners and I are working on a Django project using git, a 
partner begin the project and committed it on github, then the rest of us 
copy the project on their respective computers, but when we run the "python 
manage.py runserver" command (or any other command using manage.py) the 
ones who copied the project get the next error:

Traceback (most recent call last): File "manage.py", line 15, in  
execute_from_command_line(sys.argv) File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/core/management/__init__.py",
 
line 381, in execute_from_command_line utility.execute() File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/core/management/__init__.py",
 
line 375, in execute 
self.fetch_command(subcommand).run_from_argv(self.argv) File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/core/management/__init__.py",
 
line 224, in fetch_command klass = load_command_class(app_name, subcommand) 
File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/core/management/__init__.py",
 
line 36, in load_command_class module = 
import_module('%s.management.commands.%s' % (app_name, name)) File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/importlib/__init__.py",
 
line 127, in import_module return _bootstrap._gcd_import(name[level:], 
package, level) File "", line 1006, in 
_gcd_import File "", line 983, in 
_find_and_load File "", line 967, in 
_find_and_load_unlocked File "", line 677, in 
_load_unlocked File "", line 728, in 
exec_module File "", line 219, in 
_call_with_frames_removed File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/core/management/commands/migrate.py",
 
line 14, in  from django.db.migrations.autodetector import 
MigrationAutodetector File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/db/migrations/autodetector.py",
 
line 11, in  from django.db.migrations.questioner import 
MigrationQuestioner File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/db/migrations/questioner.py",
 
line 9, in  from .loader import MigrationLoader File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/db/migrations/loader.py",
 
line 8, in  from django.db.migrations.recorder import 
MigrationRecorder File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/db/migrations/recorder.py",
 
line 9, in  class MigrationRecorder: File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/db/migrations/recorder.py",
 
line 22, in MigrationRecorder class Migration(models.Model): File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/db/models/base.py",
 
line 87, in __new__ app_config = apps.get_containing_app_config(module) 
File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/apps/registry.py",
 
line 249, in get_containing_app_config self.check_apps_ready() File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/apps/registry.py",
 
line 131, in check_apps_ready settings.INSTALLED_APPS File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/conf/__init__.py",
 
line 57, in __getattr__ self._setup(name) File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/conf/__init__.py",
 
line 44, in _setup self._wrapped = Settings(settings_module) File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/site-packages/django/conf/__init__.py",
 
line 107, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) 
File 
"/home/marcoadv/Documentos/Mat-programacion/SoftwareDevelopment/classTime_ve/lib/python3.7/importlib/__init__.py",
 
line 127, in import_module return _bootstrap._gcd_import(name[level:], 
package, level) ModuleNotFoundError: No module named 'classTime'
It basically says that manage.py can't find the module of the actually 
project, I was searching on the browser finding an answer, saying that I 
need to run it in a virtual envirioment, but I still getting the error, 
Does somebody know how to solve it? I'll really appreciate your answers


If you need more details I will give them to you,

-- 
You received this message because you are subscribed to the Google Groups 
"Django 

Envío de formulario con una tabla dinámica

2017-12-20 Thread Antonio Veliz
bueno estoy ya trabajando con un formulario que tiene una tabla dinámica, 
en la tabla puedo adicionar y eliminar las filas hasta alli todo bien, lo 
que nececito que me ayuden en 2 cosas que no he podido resolver: 1-) El 
segundo select es dependiente del primero y no se hace nada no se que error 
pueda tener ,llevar las sumas totales de cada columna y fila , 2-) enviar 
el formulario completo, se que es un problema enviar la tabla dentro del 
formulario pero me sirve enviarlo como matriz yo me emmcargo después buscar 
los datos en la controladora. Trabajo con python, django,jquery, bootstrap, 
el codigo:

$(document).ready(function () {
$("#nuevoServicio").click(function () {
var tableReg = document.getElementById("tablaserviciosprest");
$("#tablaserviciosprest").append("" + tableReg.rows[1].innerHTML + 
"");

$('.eliminalinea').off().click(function (e) {
$(this).parent('td').parent('tr').remove();
});
addcambios();
});
});

function addcambios() {
$(".seleccionarArea1").change(function () {
var $servselect = $(this).parents("tr").find("td")[1].children[0];
$servselect.disabled = false;
}); 
}
function empty(unselect) {
for (var i = 1; i < unselect.children.length; i++) {
unselect.children[i].remove();
}
}



https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js";>
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css;>
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.js";>


x
Adicionar Servicio Prestado






Área*:


Seleccione Área ...
{% for area in area_List %}
{{ area.area }}
{% endfor %}




Cliente*:


Seleccione Cliente ...
{% for cliente in cliente_List %}
{{ cliente.nombreEmp }}
{% endfor %}




Servicios 
Prestados*:




Área
Servicio
Precio CUP
Precio CUC
Precio Total
Cantidad
Costo Total
Opciones






Seleccione Área ...
Comercio
Aplicaciones Informáticas
Desarrollo




Seleccione Servicio ...
















Seleccione Área ...
Comercio
Aplicaciones Informáticas
Desarrollo




Seleccione Servicio ...















Nuevo Servicio




Por Cobrar:









Guardar
Cerrar




Espero que me puedan ayudar ya que llevo varios dias en esto y no doy con 
la solución

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ffe4de5c-3cfa-43ee-8217-4e5f0ce7674d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Channels] Unit tests simulating two connections

2017-05-10 Thread Luís Antonio De Marchi
First of all I'm sorry for my English, I'm supported by the translator.

I'm trying to simulate 2 simultaneous connections in my unit tests, but 
channel name gets repeated and causes the system to "ignore" one of the 
connections.

self._send_and_consume('websocket.connect', {"text": "", "path": "/"})
> --> *message.reply_channel.name = defaultwddHR*

 

>
> self._send_and_consume('websocket.connect', {"text": "", "path": "/"})
> --> *message.reply_channel.name = defaultwddHR*


The two calls go through every stream, but I used the connection name as 
the primary key. So when I'm having trouble doing tests.

PS: Running in "real" environment works. Is random channel name.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e7abd141-0fb6-4b46-b87f-b78daec6e084%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels, Websockets and 'Backpressure'

2017-04-27 Thread Luís Antonio De Marchi
First I need to ask for patience with my English, the translator is helping.

We are creating an project with forecasts of millions of connections per 
second. We've never worked with websocket before, I heard that Crossbar.io 
was better. But I've been playing with Django Channels for some time and I 
love it.

We are 60% of the project with Django Channels and I discovered a stress 
test tool, which is called "tsung". With this test "I was able" to reach 
the mentioned message.

I also heard that Django Channels with Docker is fully scalable, but how do 
you actually scale it?

Sorry for my ignorance, I'm very worried that the project is a failure in 
start. It may never reach the expected numbers, but the system will appear 
on the television network and we have chances that it will actually happen 
(at least a few minutes)

Em sexta-feira, 2 de dezembro de 2016 02:06:24 UTC-2, Andrew Godwin 
escreveu:
>
>
>
> On Thu, Dec 1, 2016 at 1:03 PM, Hank Sims  > wrote:
>
>> You set it in the channel layer configuration in Django, like this: 
>>> https://github.com/django/asgi_redis/#usage
>>>
>>
>> Ah, thank you. Sorry I missed that. 
>>  
>>
>>> How would you propose this worked? The only alternative to closing the 
>>> socket is to buffer the messages in memory and retry sending them, at which 
>>> point you might have the case where the client thinks they have a working 
>>> connection but it's not actually delivered anything for 30 seconds. Hard 
>>> failure is preferable in distributed systems in my experience; trying to 
>>> solve the problem with soft failure and retry just makes problems even more 
>>> difficult to detect and debug.
>>>
>>
>> I guess the "hard failure" I would prefer in this case -- though maybe 
>> not all cases -- is simply discarding new outbound messages when their 
>> queue is full. Or else some sort of mechanism from within my consumers.py 
>> that would allow me to forgo writing to a channel if its queue is full.
>>
>
> You already get this - trying to send to an outbound channel when it is 
> full will raise the ChannelFull exception. What you're seeing is the 
> inbound channel filling up, and the ASGI spec says that websocket protocol 
> servers should drop the connection if they can't send an incoming message 
> from a socket.
>
> Andrew
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/33b64948-d47a-459d-9f48-3c6459f15821%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django vs ExtJS

2015-06-08 Thread Antonio Saponara
ExtJS is a REST *client* wich uses  basic CRUD calls to obtain great 
results with *few lines of code*!

It supports CRUD, pagination, sorting and filtering out of the box! Please 
respect also the 2nd class citizen :-|

Django-rest-framework of course is  server-side so it is incomparable! It 
does a lot of things exactly like many other frameworks. The real point is 
that you, as a programmer appreciate django for features, reliability, and 
many other aspects, but your customers needs to see other things like 
available developers, competitors, references etc etc

I'd love to see django do the same thing i have done with my Zend proxy. 
Manage a table's crud created in realtime with zero added code!

I mean, you configure the db connection, and every REST calls will manage 
EVERY table in selected db via CRUD calls, automatically. 
Without configuring table, keys, fields and so on.

This can be a great way to  scaffold a prototype really fast!

Once you are at an advanced stage, you can simply change the REST pointers 
to a more advanced rest-server ;-)



Il giorno lunedì 8 giugno 2015 13:23:18 UTC+2, Jani Tiainen ha scritto:
>
> Hi, 
>
> I've been working with relatively large (GIS) apps that do use ExtJS and 
> Django. 
>
> What comes to ExtJS and it's "REST" that is pure joke. It's not even close 
> what REST should be. There is even long standing thread on ExtJS forums 
> about having better support for REST but I guess it's totally 2nd class 
> citizen in ExtJS world. But we chose ExtJS because it's components, 
> specially grids and trees are pretty much best you can get for the money. 
>
> And as ExtJS is purely Javascript framework it doesn't have anything to do 
> with actually Django, which is server side Web framework, written with 
> Python. 
>
> What comes to Django it's development speed. You can evaluate and iterate 
> development much faster in Django than in Java (at least in my experience). 
> With development server just change something, go browser and refresh. With 
> django-rest-framework (the big gun for REST apis in Django) you can even 
> develop rest services without having special frontend for that - drf 
> provides nice html API tool that makes developing (and even testing) faster 
> - while you're building and testing your API you can have your frontend 
> devs to do that. 
>
> And that's where Django and Python excels. Also Django has rather 
> extensive set of tools that are crafted to work with web and database. ORM, 
> Admin (which is valuable tool while developing), basic user system, 
> authentication and authorization, permissions, form handling and data 
> validation, and much more. 
>
>
>
> On Mon, 29 Dec 2014 06:55:57 -0800 (PST) 
> Joris Benschop  wrote: 
>
> > Hi List, 
> > 
> > I;m a data maangement specialist in a rather large multinational. I'm 
> > trying to push Django as a fast development framework for front-end 
> > applications of our databases. Currently the company is focusing on 
> Sencha 
> > ExtJS and java solutions. Can you help me with pointers why Django is 
> > better? The free-as-in-beer argument is not very convincing by itself. 
> > 
> > Thanks 
> > Joris 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at http://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/53e17853-9922-4f77-bf9a-4cea7d35ade3%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
> -- 
> Jani Tiainen 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f0902f6a-ddc0-4671-86a1-1964cf7d9972%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django vs ExtJS

2015-06-05 Thread Antonio Saponara
Hi
I am developing my REST proxy for Sencha,

I have tested with ExtJS and Sencha Touch frameworks and it does support, 
pagination, remote filters, remote sorting and so on.

It's developed with Zend Framework 2 and can support  different DB types on 
the same installation.

Have a look at:
http://apiskeleton.asaconsult.com/




Il giorno martedì 30 dicembre 2014 14:45:08 UTC+1, Jani Tiainen ha scritto:
>
> On Mon, 29 Dec 2014 06:55:57 -0800 (PST) 
> Joris Benschop  wrote: 
>
> > Hi List, 
> > 
> > I;m a data maangement specialist in a rather large multinational. I'm 
> > trying to push Django as a fast development framework for front-end 
> > applications of our databases. Currently the company is focusing on 
> > Sencha ExtJS and java solutions. Can you help me with pointers why 
> > Django is better? The free-as-in-beer argument is not very convincing 
> > by itself. 
> > 
>
> I'll give my late insight here. We're having rather large SPA's built 
> on top of ExtJS + Django and REST rather successfully. 
>
> Of course ExtJS and REST is really a joke - there is nothing that 
> really proper rest support in ExtJS, (no HATEOAS at all) 
>
> For a Django side REST tool we've been using DRF 
> (Django-Rest-Framework) which big gun for REST api. 
>
> Now why we picked Django over several others - We tried PHP, we 
> used Java for few web apps (and it's still in use). First reason was 
> the speed. We could implement features much faster with Python and 
> Django than we ever could do with Java (we did similiar apps with Java 
> as well but pace was definitely slower). Specially getting things 
> done within a reasonable time. Also lot of boilerplate code was 
> unnecessary. In Java we had really carefully plan every attribute and 
> getters and setters. Python makes lot of shortcuts there and it's much 
> more easier to do "magic". Though there lies a danger - you can write 
> Python code as Java (or even like C code) and that is not pretty 
> sight... 
>
> Another reason was level of complexity - even simplest Java app 
> (deployed on Tomcat) takes lot of efforts and "special" knowledge, not 
> to mention that you have to match versions you build with java versions 
> and complex configuration. Python is much more forgiving in those parts. 
>
> Of course we've ran a few issues on the road, like composite keys and 
> some "oo" features of Django ORM that were possible with Hibernate. 
>
> So current main setup in our development stack is Python (2.7), Django 
> (1.5), Oracle (10g and 11g), ExtJS (4.3), Dojotoolkit (1.6), OpenLayers 
> (2.x) and mapserver (6.x) 
>
> -- 
>
> Jani Tiainen 
>
> -- 
>
> Jani Tiainen 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a7fdfc7c-2797-4aa4-8443-e5b5dc1caef0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: response to ajax (jquery) with variables

2014-08-31 Thread Antonio Russoniello

Thank you Andreas ... I got it !!!

AR

El 30/08/2014 05:04 a.m., Andreas Kuhne escribió:

Hi again Antonio,

First of all, make sure you are using a good browser with debugging 
capabilities (I prefer Chrome), because you'll need it.


Secondly, I usually use the $.ajax request, instead of the post. 
Mainly because post is a wrapper around ajax and you can more finely 
change the settings of ajax.


So the post in your case would be:

$.ajax({
type: 'POST',   // Make sure you post
dataType: 'json',  // Use this so that you request json 
from the server

url: "/sitioweb/json/",
data: data,
success: function(data) {
// The data that is returned is your json data, already 
parser, so you don't have to parse it!
alert(data.array[0]); // Need to write "array" because 
that is what you are sending to the browser (your structure looks like 
that, check what the server is responding with)

},
error: function(xhr, textStatus, errorThrown) {
console.log('AJAX communication failed:', textStatus, 
errorThrown);// In case there is an error (for example a 500)

}
});

Regards,

Andréas

2014-08-30 4:57 GMT+02:00 Antonio Russoniello 
<aruss...@musicparticles.com <mailto:aruss...@musicparticles.com>>:


Now I can read data from  ajax to my def but I have not idea to
how send, for examle, an array to jquery and manage this from
javascript...

I tried:

def json_prueba(request):
arrg = [1,2,3,4]
if request.method == 'POST':
return HttpResponse(simplejson.dumps({'array': arrg}),
content_type="application/json")
return HttpResponse('FAIL!')

from the page side:

function updateDB(){
$.post("/sitioweb/json/", data, function(response){
if(response){
var data = JSON.parse(*response*); <- NOT
SURE IF THIS IS CORRECT
alert(data[0]); }  <- I´m trying
to put on an alert windows the first item of my array arrg
else{ alert('Error! :(');}
});
}

Thanks in advande.

AR


El 28/08/2014 02:57 a.m., Andreas Kuhne escribió:

Hi Antonio,

import simplejson as json

return HttpResponse(
json.dumps({
'array': example
}),
content_type="application/json"
)

That would do the trick. This is returned as JSON. Remember to
set the content_type, otherwise the client can get confused.

Regards,

Andréas

2014-08-28 2:56 GMT+02:00 Antonio Russoniello
<aruss...@musicparticles.com <mailto:aruss...@musicparticles.com>>:

Hello,

i hope you can help me with this, I'm trying to send to an
ajax (jquery from my html template) a response but i would
like to send also a new variable.

in my html template I have:

$("#init_date").click(function(){
var some_date = {'init_date': init_date, 'end_date':
end_date};
$.post("/filter_dates/", some_date, function(response){
if(response === 'success'){
/MAKE SOMETHING//!!!/
else{ alert('error'); }
});
});

my django view look like:

def filter_date(request):
if request.method == 'POST':
example = ['A','B','C']
init_date = request.POST['init_date']
end_date = request.POST['end_date']
 MAKE SOMETHING!!
return HttpResponse('success') /AND HERE I WOULD LIKE
TO SEND THE example ARRAY.../
else:
return HttpResponse('error')

How can I send the array o some other variable as response?

Regards,
AR
-- 
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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com

<https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the

Google Groups "Django users" g

Re: response to ajax (jquery) with variables

2014-08-29 Thread Antonio Russoniello
Now I can read data from  ajax to my def but I have not idea to how 
send, for examle, an array to jquery and manage this from javascript...


I tried:

def json_prueba(request):
arrg = [1,2,3,4]
if request.method == 'POST':
return HttpResponse(simplejson.dumps({'array': arrg}), 
content_type="application/json")

return HttpResponse('FAIL!')

from the page side:

function updateDB(){
$.post("/sitioweb/json/", data, function(response){
if(response){
var data = JSON.parse(*response*); <- NOT SURE 
IF THIS IS CORRECT
alert(data[0]); }  <- I´m trying to put 
on an alert windows the first item of my array arrg

else{ alert('Error! :(');}
});
}

Thanks in advande.
AR


El 28/08/2014 02:57 a.m., Andreas Kuhne escribió:

Hi Antonio,

import simplejson as json

return HttpResponse(
json.dumps({
'array': example
}),
content_type="application/json"
)

That would do the trick. This is returned as JSON. Remember to set the 
content_type, otherwise the client can get confused.


Regards,

Andréas

2014-08-28 2:56 GMT+02:00 Antonio Russoniello 
<aruss...@musicparticles.com <mailto:aruss...@musicparticles.com>>:


Hello,

i hope you can help me with this, I'm trying to send to an ajax
(jquery from my html template) a response but i would like to send
also a new variable.

in my html template I have:

$("#init_date").click(function(){
var some_date = {'init_date': init_date, 'end_date':
end_date};
$.post("/filter_dates/", some_date, function(response){
if(response === 'success'){
/MAKE SOMETHING//!!!/
else{ alert('error'); }
});
});

my django view look like:

def filter_date(request):
if request.method == 'POST':
example = ['A','B','C']
init_date = request.POST['init_date']
end_date = request.POST['end_date']
 MAKE SOMETHING!!
return HttpResponse('success') /AND HERE I WOULD LIKE TO
SEND THE example ARRAY.../
else:
return HttpResponse('error')

How can I send the array o some other variable as response?

Regards,
AR
-- 
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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com

<https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto:django-users@googlegroups.com>.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUbnxRG8cs7_4-ALJUubXRPhx%2B2FQE1NA7bkTiBqoB1ySLw%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CALXYUbnxRG8cs7_4-ALJUubXRPhx%2B2FQE1NA7bkTiBqoB1ySLw%40mail.gmail.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.


--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54013DA3.3090901%40musicparticles.com.
For more options, visit https://groups.google.com/d/optout.


Re: response to ajax (jquery) with variables

2014-08-29 Thread Antonio Russoniello

Thanks Andréas,

I will try it.

Regards/AR


El 28/08/2014 02:57 a.m., Andreas Kuhne escribió:

Hi Antonio,

import simplejson as json

return HttpResponse(
json.dumps({
'array': example
}),
content_type="application/json"
)

That would do the trick. This is returned as JSON. Remember to set the 
content_type, otherwise the client can get confused.


Regards,

Andréas

2014-08-28 2:56 GMT+02:00 Antonio Russoniello 
<aruss...@musicparticles.com <mailto:aruss...@musicparticles.com>>:


Hello,

i hope you can help me with this, I'm trying to send to an ajax
(jquery from my html template) a response but i would like to send
also a new variable.

in my html template I have:

$("#init_date").click(function(){
var some_date = {'init_date': init_date, 'end_date':
end_date};
$.post("/filter_dates/", some_date, function(response){
if(response === 'success'){
/MAKE SOMETHING//!!!/
else{ alert('error'); }
});
});

my django view look like:

def filter_date(request):
if request.method == 'POST':
example = ['A','B','C']
init_date = request.POST['init_date']
end_date = request.POST['end_date']
 MAKE SOMETHING!!
return HttpResponse('success') /AND HERE I WOULD LIKE TO
SEND THE example ARRAY.../
else:
return HttpResponse('error')

How can I send the array o some other variable as response?

Regards,
AR
-- 
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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com

<https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto:django-users@googlegroups.com>.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUbnxRG8cs7_4-ALJUubXRPhx%2B2FQE1NA7bkTiBqoB1ySLw%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CALXYUbnxRG8cs7_4-ALJUubXRPhx%2B2FQE1NA7bkTiBqoB1ySLw%40mail.gmail.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.


--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/540136FE.9000809%40musicparticles.com.
For more options, visit https://groups.google.com/d/optout.


response to ajax (jquery) with variables

2014-08-27 Thread Antonio Russoniello

Hello,

i hope you can help me with this, I'm trying to send to an ajax (jquery 
from my html template) a response but i would like to send also a new 
variable.


in my html template I have:

$("#init_date").click(function(){
var some_date = {'init_date': init_date, 'end_date': end_date};
$.post("/filter_dates/", some_date, function(response){
if(response === 'success'){
/MAKE SOMETHING//!!!/
else{ alert('error'); }
});
});

my django view look like:

def filter_date(request):
if request.method == 'POST':
example = ['A','B','C']
init_date = request.POST['init_date']
end_date = request.POST['end_date']
 MAKE SOMETHING!!
return HttpResponse('success') /AND HERE I WOULD LIKE TO SEND 
THE example ARRAY.../

else:
return HttpResponse('error')

How can I send the array o some other variable as response?

Regards,
AR

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com.
For more options, visit https://groups.google.com/d/optout.


Re: Expected URL with primary key when testing SimpleTestCase.assertRedirects()

2014-06-18 Thread Antonio Alaniz
Thanks, K. I think one of my main issues, after looking at your tests, is 
that I'm not currently using the client to test the redirect. I have this 
test as a part of my functional_tests.py, but it sounds like I need to 
possibly build this into my unit tests as I see your test is in tests.py. 
I'm going move some of this work around between functional and unit tests 
and then try out your suggestion with the client. 

Tony

On Tuesday, June 17, 2014 7:26:27 PM UTC-7, Antonio Alaniz wrote:
>
> I'm testing a redirect that would include the primary key. Can anyone tell 
> me how I can test the redirect URL if it involves the primary key? Will the 
> following work?:
>
> self.assertRedirects(response, 'message/(?P\d+)/', 200)
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/268c0cf6-2829-445a-a97d-8c7832121247%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Expected URL with primary key when testing SimpleTestCase.assertRedirects()

2014-06-17 Thread Antonio Alaniz
I'm testing a redirect that would include the primary key. Can anyone tell 
me how I can test the redirect URL if it involves the primary key? Will the 
following work?:

self.assertRedirects(response, 'message/(?P\d+)/', 200)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d676d6a7-5ab5-408e-902b-958b39798ddd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: py2exe + Django 1.6

2014-04-10 Thread Antonio Francisco Martín Romero
Thank you very much.

I can see the commands but I get an error when I try to run one. I have 
attached my manage.py file. See below the errors


>manage.exe shell
Traceback (most recent call last):
  File "manage.py", line 28, in 
  File "django\core\management\__init__.pyc", line 365, in 
execute_from_command_
line
  File "django\core\management\__init__.pyc", line 358, in execute
  File "django\core\management\base.pyc", line 242, in run_from_argv
  File "django\core\management\base.pyc", line 280, in execute
  File "django\utils\translation\__init__.pyc", line 130, in activate
  File "django\utils\translation\trans_real.pyc", line 188, in activate
  File "django\utils\translation\trans_real.pyc", line 178, in translation
  File "django\utils\translation\trans_real.pyc", line 146, in _fetch
AttributeError: 'NoneType' object has no attribute '_info'

Cheers


On Thursday, April 10, 2014 2:29:38 PM UTC+1, johan de taeye wrote:
>
>
> This is very old issue in Django: see ticket 
> https://code.djangoproject.com/ticket/8280
> I've attached the patch I'm already using for years to package my django 
> application with py2exe.
>
> I don't understand why the core team continues to use the current 
> un-pythonic code to discover commands and fails to merge any of the fixes 
> that have been proposed.
>
> Johan
>
>
> Op donderdag 10 april 2014 14:19:19 UTC+2 schreef Antonio Francisco Martín 
> Romero:
>>
>> Hi everyone,
>>
>> I was using py2exe + Django 1.3 without problems. From Django 1.4 the way 
>> to find the commands changed  and it tries to find .py files as you can see 
>> in the find_commands() function in the file core/management/__init__.py . 
>> When you compile Django using py2exe, your don't have .py files, just .pyc 
>> and manage.exe won't have any command. I have tried to modify the 
>> find_command() function but the result was negative. Also, I have tried to 
>> run commands manually but the functions try to find .py files as well.
>>
>> Did anyone manage to do it?
>>
>> Cheers
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/22a72b73-76a0-4730-bbf8-2c1e0d79bee8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#!/usr/bin/env python 
import multiprocessing 
import os 
import sys 
import Cookie
import htmlentitydefs
import HTMLParser
from server.settings import EMARKER_PRODUCTION 
  
if "manage.exe" in sys.executable: 
#We need this so the service can work with multiple process 
executable = os.path.join(os.path.dirname(sys.executable), 'multi_helper.exe') 
multiprocessing.set_executable(executable)  
  
from django.core.management import execute_from_command_line 
import django 
  
try: 
import server.settings # Assumed to be in the same directory. 
except ImportError: 
import sys 
   
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) 
sys.exit(1) 
  
if __name__ == "__main__": 
sys.argv.append('--settings=server.settings') 
execute_from_command_line(sys.argv) 


py2exe + Django 1.6

2014-04-10 Thread Antonio Francisco Martín Romero
Hi everyone,

I was using py2exe + Django 1.3 without problems. From Django 1.4 the way 
to find the commands changed  and it tries to find .py files as you can see 
in the find_commands() function in the file core/management/__init__.py . 
When you compile Django using py2exe, your don't have .py files, just .pyc 
and manage.exe won't have any command. I have tried to modify the 
find_command() function but the result was negative. Also, I have tried to 
run commands manually but the functions try to find .py files as well.

Did anyone manage to do it?

Cheers

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d20a0820-24b3-4832-bf18-9bb77b124b7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


API rest for https://docs.djangoproject.com/en/dev/intro/tutorial01/ help

2014-02-20 Thread Antonio Villavicencio
I am trying just to do an API REST with the project of:
https://docs.djangoproject.com/en/dev/intro/tutorial01/

specifically with the model of Question

class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')

class Choice(models.Model):
question = models.ForeignKey(Question)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)


I want to apply a serializer with question's choices but I don't know how 
to do it

class QuestionSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Question
fields = (*'id', 'question_text'*, ? ) 


I need some suggestion to solve this problem.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a2b02a3d-f5bf-4a78-b848-48b0e076d5f3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


There are plans for a django direct connection to ibm i db2 (iseries)

2013-10-21 Thread Antonio Campos
Hi , I'me new to django and I know there are the db2 remote connection to 
ibm I (iseries), but it is not free. So my question is if there are plans 
to developer a driver to connect directly from django to IBM I.Django is 
great and IBM I is a great server too and have na option for IBM I 
like MYSQL or Oracle is great.
 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/68c9dc3a-6891-4e8f-8ac2-3b0168694a7c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Custom django menu and page

2013-10-11 Thread Juan Antonio García Cano
In my django admin site, i have the menu with the name of my app and in 
this section all the models that i have registered in admin.py

I want to know if it is posible to put in the main menu and submenu a 
custom entry, with custom templates. (These pages will be only for work and 
show data, there will be not "admin.site.register(...)")

It is posible to do this?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dcd253c0-3d48-4f74-aa05-cc22d45a0c94%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Model inheritance problem

2013-09-17 Thread Antonio Mignolli
Hmm, no, it does not work even without indexed=True, 
my mistake.
So the "issue" remains.

Il giorno martedì 17 settembre 2013 16:17:04 UTC+2, Antonio Mignolli ha 
scritto:
>
> Thanks, George, but as I said in the beginning, I'm using neo4django, 
> which surely has StringProperty, otherwise I would have an 
> AttributeError on StringProperty, which I don't have.
>
> I should have written:
> from neo4django.db import models
>
> and 
> ...
> name = models.StringProperty(indexed=True)
>
> for completeness.
>
> I think I just discovered another neo4django issue,
> in fact it works perfectly only if such attribute 
> is not defined with indexed = True.
>
>
> Il giorno martedì 17 settembre 2013 14:27:34 UTC+2, George Lund ha scritto:
>>
>>
>> class MyBaseModel(models.NodeModel):
>>>name=StringProperty()
>>>class Meta:
>>>abstract = True
>>>
>>>
>> In Django you would need CharField or similar. StringProperty is a Google 
>> App Engine thing? Cf 
>> http://stackoverflow.com/questions/6132695/django-module-object-has-no-attribute-stringproperty
>>
>> So your base model has no field called "name".
>>
>> HTH
>>
>> George
>>
>

-- 
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: Model inheritance problem

2013-09-17 Thread Antonio Mignolli
Thanks, George, but as I said in the beginning, I'm using neo4django, 
which surely has StringProperty, otherwise I would have an 
AttributeError on StringProperty, which I don't have.

I should have written:
from neo4django.db import models

and 
...
name = models.StringProperty(indexed=True)

for completeness.

I think I just discovered another neo4django issue,
in fact it works perfectly only if such attribute 
is not defined with indexed = True.


Il giorno martedì 17 settembre 2013 14:27:34 UTC+2, George Lund ha scritto:
>
>
> class MyBaseModel(models.NodeModel):
>>name=StringProperty()
>>class Meta:
>>abstract = True
>>
>>
> In Django you would need CharField or similar. StringProperty is a Google 
> App Engine thing? Cf 
> http://stackoverflow.com/questions/6132695/django-module-object-has-no-attribute-stringproperty
>
> So your base model has no field called "name".
>
> HTH
>
> George
>

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


Model inheritance problem

2013-09-15 Thread Antonio Mignolli
Hi, I posted something similar also to italian Django-it group.

I'm using neo4django, but I want to understand things in a more 
generic way.

My case:

class MyBaseModel(models.NodeModel):
   name=StringProperty()
   class Meta:
   abstract = True

NodeModel it's a graph Node, like a record in a relational DB.

I inherit from MyBaseModel:

class User(MyBaseModel):
email=StringProperty()

I wish I could do the following:

Tony=User.objects.create(name="Tony",email="t...@anymail.bah")

but I got the error:
TypeError: 'name' is an invalid keyword argument for this function

Should I write the __init__?
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.


Call action with a link in the admin site

2013-07-04 Thread Juan Antonio García Cano


In the admin.py i have this function:

actions = ['generar_pdf']
def generar_pdf(self, request, queryset):

... (This function make a PDF of the object selected)

And i show one button in the list_display (of the admin site) with this 
function:

def boton_mail(self,obj):
return mark_safe('http://mypage/static/admin/img/descargar_pdf.png; alt="Descargar PDF" 
width=30 height=25>')

It is posible to call the function "generar_pdf" with a link (< a >) in the 
function "boton_mail"?

(I want to call the action from a image in the list display in the admin 
site)

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




Error in GeoDjango Tutorial- Help

2011-11-22 Thread Antonio Rocha
Greetings
I'm following this tutorial (https://docs.djangoproject.com/en/dev/ref/
contrib/gis/tutorial/) (Great Workd by the way)
but I got this error in load.run()

Failed to save the feature (id: 0) into the model with the keyword
arguments:
{'iso2': u'AG', 'name': u'Antigua and Barbuda', 'area': 44, 'region':
19, 'lon': -61.7830001, 'iso3': u'ATG', 'subregion': 29,
'fips': u'AC', 'lat': 17.077, 'un': 28, 'mpoly':
'MULTIPOLYGON (((-61.686668 17.02444100138,-61.73806
16.989719,-61.82917 16.996944,-61.87611 17.016941,-61.88056
17.01972,-61.88361 17.023609,-61.88583 17.028053,-61.887222
17.03305400106,-61.89111 17.09417,-61.887222 17.10527,-61.88417
17.109722,-61.832779 17.16389,-61.826393 17.16722,-61.79445
17.16333,-61.784172 17.15833,-61.74417 17.13722,-61.674171
17.093609,-61.67028 17.090275,-61.668892 17.085,-61.66639
17.04583,-61.6675 17.04055,-61.682503 17.0275,-61.686668
17.02444100138)),((-61.72917 17.608608,-61.73112
17.547222,-61.73278 17.54,-61.73889 17.540554001,-61.75194
17.549442,-61.81556 17.583885,-61.834724 17.588608,-61.839447
17.58,-61.842781 17.582775,-61.8475 17.58083000105,-61.85306
17.583054,-61.856674 17.5925,-61.873894 17.69,-61.875282
17.69861,-61.873062 17.703888,-61.85028 17.72277500127,-61.84556
17.724998,-61.83917 17.72472000104,-61.78722 17.700554,-61.78361
17.69722,-61.74334 17.653053,-61.74028 17.649166,-61.73806
17.64472200115,-61.73167 17.624996,-61.72917 17.608608)))',
'pop2005': 83039}
Traceback (most recent call last):
  File "", line 1, in ?
  File "/home/anrr/Django_test/geodjango/world/load.py", line 26, in
run
lm.save(strict=True, verbose=verbose)
  File "/usr/lib/python2.4/site-packages/django/contrib/gis/utils/
layermapping.py", line 608, in save
_save()
  File "/usr/lib/python2.4/site-packages/django/db/transaction.py",
line 217, in inner
res = func(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/django/contrib/gis/utils/
layermapping.py", line 558, in _save
m.save(using=self.using)
  File "/usr/lib/python2.4/site-packages/django/db/models/base.py",
line 460, in save
self.save_base(using=using, force_insert=force_insert,
force_update=force_update)
  File "/usr/lib/python2.4/site-packages/django/db/models/base.py",
line 553, in save_base
result = manager._insert(values, return_id=update_pk, using=using)
  File "/usr/lib/python2.4/site-packages/django/db/models/manager.py",
line 195, in _insert
return insert_query(self.model, values, **kwargs)
  File "/usr/lib/python2.4/site-packages/django/db/models/query.py",
line 1436, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
  File "/usr/lib/python2.4/site-packages/django/db/models/sql/
compiler.py", line 791, in execute_sql
cursor = super(SQLInsertCompiler, self).execute_sql(None)
  File "/usr/lib/python2.4/site-packages/django/db/models/sql/
compiler.py", line 735, in execute_sql
cursor.execute(sql, params)
  File "/usr/lib/python2.4/site-packages/django/db/backends/util.py",
line 34, in execute
return self.cursor.execute(sql, params)
  File "/usr/lib/python2.4/site-packages/django/db/backends/
postgresql_psycopg2/base.py", line 44, in execute
return self.cursor.execute(query, args)
DatabaseError: current transaction is aborted, commands ignored until
end of transaction block

Any tip on what it might be missing?

-- 
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 display an image from model

2011-11-21 Thread antonio
I'm newbie using django, and I neeto to display a image from
the model, I've read about serving static conten but it's not clear to
me how to do it.
This is my model:

class Author(models.Model):
  first_name = models.CharField(max_length=30)
  headshot = models.ImageField(upload_to='img/')

So i put in the urls.py to retrieve the image from author:

(r'^image/(\d{1,2})/$', image),

In the views:
from books.models import Author
def image(request,author_id):
  autor = get_object_or_404(Author, pk=author_id)
  html = "" %
(autor.headshot.url)
  return HttpResponse(html)

It gets 404 error, any help?

-- 
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: problems with errors in templates

2011-04-18 Thread Antonio Sánchez
thanks, i think you are right, but now i cant check it, i'll do it
later!

thanks!

On 17 abr, 23:00, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Sunday, 17 April 2011 21:41:15 UTC+1, Antonio Sánchez wrote:
>
> > hi, im working with a modelform, and overrided clen methos for making
> > some custom checks, raising a forms.ValidationError when i need, im
> > sure this error is raised, but i dont know why in the template errors
> > are not showed (instead of form is showed again cause it's not
> > valid!), here is some of the code:http://pastebin.com/j2SvJYgA some
> > help, thanks
>
> With that code, if the form is not valid and `new` is None, the form will be
> re-instantiated without any bound data. Replace `if new is None` with `elif
> new is None`.
> --
> DR.

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



problems with errors in templates

2011-04-17 Thread Antonio Sánchez
hi, im working with a modelform, and overrided clen methos for making
some custom checks, raising a forms.ValidationError when i need, im
sure this error is raised, but i dont know why in the template errors
are not showed (instead of form is showed again cause it's not
valid!), here is some of the code: http://pastebin.com/j2SvJYgA  some
help, thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: problems with redirect function

2011-04-11 Thread Antonio Sánchez
http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#redirect

"You can use the redirect() function in a number of ways.
2. By passing the name of a view and optionally some positional or
keyword arguments; the URL will be reverse resolved using the
reverse() method"

I think it's possible, but i cant do it work!

On Apr 11, 12:42 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Monday, April 11, 2011 12:00:37 AM UTC+1, Antonio Sánchez wrote:
>
> > hi, im trying to use redirect shortcut, but im having problems passing
> > arguments to the view i want to reverse.
>
> > view definition is this:
>
> > def profile(request, activation_key=None, new=None):
> > if new is None:
> > return HttpResponse("You're at the profile.")
> > else:
> > return HttpResponse("New User!\nYou're at the profile.")
>
> > my urls looks like this (and works):
> > url(r'^profile/(?P\w+)/$', profile, {'new': 1},
> > name='profile_view'),
>
> > but in other view, i try to use redirect, doing this:
> > 
> > kwargs['new'] = 1
> > return redirect(success_url, **kwargs)
> > 
>
> > I add 'new' parameter and sets it to 1 (just like in url definition!),
> > but it fails:
> > Reverse for 'profile_view' with arguments '()' and keyword arguments
> > '{'new': 1, 'activation_key':
> > u'ad6ef997beccb16dee9184d1602dad086dfa1b97'}' not found.
>
> > the point is that if i delete that param (new), from view definition,
> > url, and dont add in the view calls return, it works...
>
> > some idea??
> > thanks!
>
> What you are trying to do makes no sense. Redirection sends the browser to
> another URL. The only parameters that are possible are those in the URL
> itself. For whatever reason, you have not put your `new` parameter in the
> URL, but hard-coded it in urls.py. If you need to pass a parameter, put it
> into the URL (or, alternatively, store it in the session).
> --
> DR.

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



problems with redirect function

2011-04-10 Thread Antonio Sánchez
hi, im trying to use redirect shortcut, but im having problems passing
arguments to the view i want to reverse.

view definition is this:

def profile(request, activation_key=None, new=None):
if new is None:
return HttpResponse("You're at the profile.")
else:
return HttpResponse("New User!\nYou're at the profile.")


my urls looks like this (and works):
url(r'^profile/(?P\w+)/$', profile, {'new': 1},
name='profile_view'),

but in other view, i try to use redirect, doing this:

kwargs['new'] = 1
return redirect(success_url, **kwargs)



I add 'new' parameter and sets it to 1 (just like in url definition!),
but it fails:
Reverse for 'profile_view' with arguments '()' and keyword arguments
'{'new': 1, 'activation_key':
u'ad6ef997beccb16dee9184d1602dad086dfa1b97'}' not found.

the point is that if i delete that param (new), from view definition,
url, and dont add in the view calls return, it works...

some idea??
thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: extending django-registration forms

2011-04-07 Thread Antonio Sánchez
i have tried a lot things, but nothing works... only when i delete
that field, so that is the problem, but i dont know why!?!? :S

On 6 abr, 22:29, Antonio Sánchez <adonis28...@gmail.com> wrote:
> Hi, im having problems extending django-registration register form. i
> have extended auth.User -> UserProfile, and added some attributes, one
> of this is country, that is a ForeignKey to Country Table (Django-
> Countries, with all countries).
>
> After configuring django-registration, i extend register form , one of
> the new fields is a forms.ModelChoiceField with queryset
> Country.objects.all(), after that, i configure in a new file a new
> funtion that connects
> with user_registered signal.
>
> All works if i dont put Country field in the extended form, but if i
> do it, fails.. :
> __init__() got multiple values for keyword argument 'queryset'
>
> here are portions of this code:http://pastebin.com/LfNJisg8
>
> some help?? thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



extending django-registration forms

2011-04-06 Thread Antonio Sánchez
Hi, im having problems extending django-registration register form. i
have extended auth.User -> UserProfile, and added some attributes, one
of this is country, that is a ForeignKey to Country Table (Django-
Countries, with all countries).

After configuring django-registration, i extend register form , one of
the new fields is a forms.ModelChoiceField with queryset
Country.objects.all(), after that, i configure in a new file a new
funtion that connects
with user_registered signal.

All works if i dont put Country field in the extended form, but if i
do it, fails.. :
__init__() got multiple values for keyword argument 'queryset'

here are portions of this code: http://pastebin.com/LfNJisg8

some help?? thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: extend User Model for custom fields

2011-03-26 Thread Antonio Sánchez
Yeah sure, i should have used "recommended" word instead of correct.

The difference between link i wrote and b-list is that the last one
uses a foreign-key, while first uses one-to-one, and this is the way
is recommended in doc, so... I think i will follow that post
recommendations.

Thanks again!

p.d.: in this case, recommendation is not no use heritange, but, in
cases where i want to extend ANOTHER app (3rd apps), how do you do it?
using inheritange?

On Mar 25, 9:30 pm, Mike Ramirez  wrote:
> On Friday, March 25, 2011 01:16:51 pm Nick Serra wrote:> Andre's solution is 
> out of date. Calvin is correct, use the user
> > profile model that is built into django auth. OP, the link you found
> > is correct.
>
> > >http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-m...
>
> > > > > > here:
> > > > > >http://docs.djangoproject.com/en/1.2//topics/auth/#storing-
>
> additional-information-about-users
>
> and:
>
> http://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-
> information-about-users
>
> What's different about these pages, except that b-list goes into a bit more
> detail?
>
> Hint: Nothing.
>
> But I don't think there is a "correct" way, just a recommended way.  I use the
> recommended way, but it's definately not the only way or 'better'.  'correct',
> 'better' in this case are subjective to the needs of the dev and/or project.
>
> Mike.
>
> --
> Reality is just a convenient measure of complexity.
>                 -- Alvy Ray Smith

-- 
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: extend User Model for custom fields

2011-03-25 Thread Antonio Sánchez
i have found this: 
http://digitaldreamer.net/blog/2010/12/8/custom-user-profile-and-extend-user-admin-django/
do you think its the correct way??

thanks for your reply!

On Mar 25, 2:12 pm, Calvin Spealman <ironfro...@gmail.com> wrote:
> The auth app includes support to use a profile model, configured with
> AUTH_PROFILE_MODULE in settings, which the docs show you how to use.
> Yes you can use inheritance, but you might assume it is a good idea to
> use what the auth app promotes.
>
>
>
> On Fri, Mar 25, 2011 at 9:04 AM, Antonio Sánchez <adonis28...@gmail.com> 
> wrote:
>
> > hi! i have a question, which is the best option about extending user model??
> > here:
> >http://docs.djangoproject.com/en/1.2//topics/auth/#storing-additional...
> > they say to create a manual OneToOneField between models and some more 
> > stuff,
> > but here:
> >http://docs.djangoproject.com/en/1.2//topics/db/models/#multi-table-i...
> > it says that with inheritance this 1:1 relationship is created 
> > automatically, both are in django docs
>
> > appart from this, i have read a lot ways, some people inherit, other use 
> > foreign key, ones redefines django's authentication backend other rewrites 
> > pre-save/save methods... :S ... so, which way do you think is better (some 
> > tutorial/blog post/something)?? thanks!
>
> > djjango’s authentication backend.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.> To post to this group, send email 
> > todjango-us...@googlegroups.com.> To unsubscribe from this group, send 
> > email todjango-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> Read my blog! I depend on your acceptance of my opinion! I am 
> interesting!http://techblog.ironfroggy.com/
> Follow me if you're into that sort of thing:http://www.twitter.com/ironfroggy

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



extend User Model for custom fields

2011-03-25 Thread Antonio Sánchez
hi! i have a question, which is the best option about extending user model?? 

here: 
http://docs.djangoproject.com/en/1.2//topics/auth/#storing-additional-information-about-users
 
they say to create a manual OneToOneField between models and some more 
stuff, 
but here: 
http://docs.djangoproject.com/en/1.2//topics/db/models/#multi-table-inheritance 
it says that with inheritance this 1:1 relationship is created 
automatically, both are in django docs

appart from this, i have read a lot ways, some people inherit, other use 
foreign key, ones redefines django's authentication backend other rewrites 
pre-save/save methods... :S ... so, which way do you think is better (some 
tutorial/blog post/something)?? thanks! 
djjango’s authentication backend.

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



Variables in parent template

2009-03-20 Thread Antonio

Hello.

My site actually uses templates extending a base template "base.html".
Now I would like to include in each page of the site a search form.
Obviously I have to work on base template.

The "immediate" solution is writing raw html to display the form. But
is that the only solution?

I was wondering if I can create e a form object and include it in each
page. Of course I can't pass it in each view through context. Is there
a way to get the html of a form object from the base template?

Thank you.
Antonio

--~--~-~--~~~---~--~~
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: Overriding update in models

2008-11-04 Thread Antonio Volpon

Thanks both.

Horrible typo. I noticed, however, that the time update isn't the
current one. Have to look at some locale?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Overriding update in models

2008-11-04 Thread Antonio Cavedoni

Ciao Antonio,

On Nov 4, 2008, at 8:58 PM, Antonio Volpon wrote:
> import datetime
> from django.db import models
>
> class Object(models.Model):
>description = models.CharField(max_length=255)
>insert_date = models.DateTimeField(editable=False)
>update_date = models.DateTimeField(editable=False)
>
>def save(self):
>if not self.id:
>self.insert_date = datetime.date.today()
>self.update_time = datetime.date.today()
>super(Object, self).save()

you have a field called update_date but then you reference it as  
self.update_time in the save() method, maybe that’s why it isn’t  
working?

Cheers!
-- 
Antonio


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Overriding update in models

2008-11-04 Thread Antonio Volpon

Alex, thanks a lot for the suggestion, but it doesn't work.

Antonio

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Overriding update in models

2008-11-04 Thread Antonio Volpon

Hello.

I am very new to Django and I'm having some problems in overriding the
save method for a simple class. In particular, the following code
(models.py) used against a Mysql database doesn't change the value of
the two date fields when i save the page in admin, while it correctly
changes the value of description. I think I'm doing something
completely wrong, right?

Thanks a lot,
Antonio

import datetime
from django.db import models

class Object(models.Model):
description = models.CharField(max_length=255)
insert_date = models.DateTimeField(editable=False)
update_date = models.DateTimeField(editable=False)

def save(self):
if not self.id:
self.insert_date = datetime.date.today()
self.update_time = datetime.date.today()
super(Object, self).save()




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django font

2008-04-01 Thread Antonio Cavedoni

On Tue, Apr 1, 2008 at 3:42 PM, Mat <[EMAIL PROTECTED]> wrote:
>  Slightly off topic here, but I'm putting a website together at the moment,
>  and need a logo, I really like the django font and it would fit in with the
>  rest of the style wonderfully, does anyone know what its called/have a link,
>  or is it a homemade logo?

The Django logotype is set in DTL Prokyon:

http://www.dutchtypelibrary.nl/Prokyon_rdrct.html

Here, a handy price list (per weight):

http://www.dutchtypelibrary.nl/PDF/pricelists/singleuser/DTL%20Prokyon_prlst.pdf

Cheers.
-- 
Antonio

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Presence of ForeignKey in list_display kills admin list view

2008-01-05 Thread Antonio Ognio a.k.a gnrfan

On Jan 4, 8:11 pm, Lee Hinde <[EMAIL PROTECTED]> wrote:

> I got some help on #django today that  helped with this. Thanks!

Could you share a bit of that bit us?

I hit the same issue yesterday. Just found my way around by defining
custom
methods in the model class then adding them to the list_display tuple
and setting
the display title with short_description:

class Example(models.Model):
customer = models.ForeignKey(Customer, verbose_name=_('customer'))
localfield = models.CharField(max_length=128,
verbose_name=_('nave'))

def show_customer(self):
  return self.customer

show_customer.short_description = _('Customer')

   Admin:
 list_display   = ('id', 'show_customer', 'localfield', )

Now, I'm still puzzled on what triggers this error. I looks like it
only happens
with some models but works ok with the others.

BTW I was able to reproduce it using lastest SVN (yesterday evening),
some
random old SVN copy I had (say, from a couple months ago) and with the
0.96.1 tarball. So the bug is still around for sure.

I found this bug in the bugtracker opened 1 year ago:

http://code.djangoproject.com/ticket/2583

It says it hasn't been assigned to anyone yet. Any news?

Regards,

Antonio.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



reassessing our Operating System

2007-09-17 Thread antonio von carmoducci

Hi Everyone.

I'm looking at reassessing our Operating System of choice for our
Django site, and I really need some background information (popularity
& suitability mainly)

If you have a minute spare I'd really appreciate some answers to the
following questions:

(live publicly viewable sites only)
1. What OS are you using to run Django on?
2. What OS do you think is most popular for running Django on?
3. What OS do you think is most suited for running Django on?

(non publicly viewable sites)
4. What OS do you think is most suited for developing Django on?

Any free form comments on choosing an OS for Django would be much
appreciated!

~Love your work in advance. Carmoda


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



RadioSelect in a MultiWidget

2007-08-07 Thread Marco Antonio Valenzuela

Hi, I need to implement a MultiValueField that contains a
HiddenField() and a ChoiceField(widget=RadioSelect()), but I can't
create a MultiWidget that contains a RadioSelect because render()
doesn't return a string for a RadioSelect, it returns a
RadioFieldRenderer.

if I overload render and change this line:
output.append(widget.render(name + '_%s' % i, widget_value, attrs))
with this one:
output.append(str(widget.render(name + '_%s' % i, widget_value,
attrs)))
it works.

is there another way to do this?

thanks in advance

here is the code, just in case you want to see it:

from django import newforms as forms

class Pregunta
def __init__(self, id_pregunta, id_respuesta):
self.id_pregunta = id_pregunta
self.id_respuesta = id_respuesta

class PreguntaWidget(forms.MultiWidget):
def __init__(self, attrs=None):
widgets = (forms.HiddenInput(), forms.RadioSelect())
super(PreguntaWidget, self).__init__(widgets, attrs)

def decompress(self, value):
if value:
return [value.id_pregunta, value.id_respuesta]
return [None, None]


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: A Semantic Web CMS [was: Re: django comparison]

2007-04-19 Thread Antonio Cavedoni
On 19/04/07, James Bennett <[EMAIL PROTECTED]> wrote:
> This is something best handled by an RDF store or an object database,
> neither of which is currently supported for Django; feel like writing
> some new backends for us? ;)

IIRC Bill de hÓra was working on such a beast. Bill?
-- 
Antonio

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



create_update and duplicate of inline

2007-02-22 Thread Antonio

hi all,

I've used the generic view 'update_object' to modify a class with a
ForeignKey() ... the urls.py:

(r'^confs/(?P\d+)/$', \
'django.views.generic.create_update.update_object', \
{ 'model': Conferma, 'login_required': True }),

the models.py:

class DatiConf(models.Model):
fk_conf = models.ForeignKey(Conferma, edit_inline = models.TABULAR)


in conferma_form.html

{% if form.daticonf %}

Dati Conferma


Comandante
Ora disormeggio

{% for x in form.daticonf %}


{{ x.com }}
{% if x.com.errors %}
{{ x.com.errors|join:", " }}
{% endif %}

...

the problem: when I save the form ALWAYS the inline data are duplicated ...
if in the first form there are 2 inline objects, in the second I found 4
inline objects and so on ...

can someone help me ??

tanks in advance ...

-- 
#include 
int main(void){char c[]={10,65,110,116,111,110,105,111,32,98,97,114,98,111,110,
101,32,60,104,105,110,100,101,109,105,116,64,116,105,115,99,97,108,105,110,101,
116,46,105,116,62,10,10,0};printf("%s",c);return 0;}

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



admin interface: insert/update

2007-02-13 Thread Antonio

hi all,

I've create a class whith a ForeignKey() who is visualized as  in
admin interface ... when I select a option from the menu and save, the
option selected change its state ('confermata') and must NOT appear in
the subsequents INSERT ... 

class Conferma(models.Model):
fk_prev = models.ForeignKey(Previsione, verbose_name="previsione",
limit_choices_to=models.Q(confermata=False))
pilota = models.CharField(maxlength=30, db_index=True)
h_chiamata = models.TimeField("ora chiamata pilota", help_text="hh:mm")
vadolig = models.BooleanField("vado ligure")
...

the problem is that when I go to update, the option loaded with the
ForeignKey NOT appear into the select menu, because it's 'confermata' ...

how can I tell to the "admin" that in UPDATE ONLY the option 'confermata'
with the Conferma() must show into the select menu ??

tanks in advance and sorry for the english !!

-- 
#include 
int main(void){char c[]={10,65,110,116,111,110,105,111,32,98,97,114,98,111,110,
101,32,60,104,105,110,100,101,109,105,116,64,116,105,115,99,97,108,105,110,101,
116,46,105,116,62,10,10,0};printf("%s",c);return 0;}

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: save many to many data

2007-02-08 Thread Antonio

* giovedì 08 febbraio 2007, alle 07:17, Russell Keith-Magee wrote :
> Ok - this is saving a form created from a model. Since your model
> contains a m2m field, the form representing that model will have an
> m2m widget, and when you save() the form, the m2m relation on the
> object will be modified.

ok ... first of all TANKS for the help and for the very clear explanation
;-)))

I've resolved (more clear and more coincise !!) with:

***
def previsione(req, varid=None):
if req.method == 'POST':
myform = nf.models.form_for_model(Prev)(req.POST)

if myform.is_valid():
if varid is not None:
instance = get_object_or_404(Prev, pk=varid)
newforms.models.save_instance(myform, instance)
else:
myform.save()

clean_path=re.sub('/[0-9]+/','',req.path)

return HttpResponseRedirect(clean_path)
else:



the last thing is that the m2m data are ALWAYS updated with an increment of
the 'id', even if data are unchanged ... but I think I've to "play"
(eventually ;-))) with the 'save()' method ...

tanks again  my turn next time ... I hope ;-)))

bye 

-- 
#include 
int main(void){char c[]={10,65,110,116,111,110,105,111,32,98,97,114,98,111,110,
101,32,60,104,105,110,100,101,109,105,116,64,116,105,115,99,97,108,105,110,101,
116,46,105,116,62,10,10,0};printf("%s",c);return 0;}

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: save many to many data

2007-02-07 Thread Antonio

* mercoledì 07 febbraio 2007, alle 11:27, Russell Keith-Magee wrote :
> > but the data are added also when I update the Previsione ...
> > searching on group archive, I think I must implement a 'save' method
> > into the Previsione class ... is correct ?
> 
> I'm not sure I understand what you're trying to do here. The save()
> method on an instance doesn't affect the m2m relations. However, there
> are other mechanisms, such as saving a web form, that will modify m2m
> forms.

what do you mean with "saving a web form" ?? saving the form and NOT
the save method on instance ?? 

I use :
***
myform = nf.models.form_for_model(Previsione)(req.POST)

if myform.is_valid():
dati = myform.save(commit=False)
***

to change eventually the 'id' value for the insert/update

***
if varid is not None:
dati.id=varid
***

> How are you updating the Previsione instances? Using a web form?
> Programmatically? Some other way?

I create a web form to insert/update the Previsione data ... my urls.py:

urlpatterns = patterns('modulistica.savona.views',
(r'^index/$', 'index'),
(r'^Previsione/$', 'previsione'),
(r'^Previsione/(?P\d+)/$', 'previsione'),
)

when I get the 'Previsione/' URL I go to insert the data ... when I get
the 'Previsione/10/' URL I go to update the data of the Previsione(pk=10).


the previsione function :

def previsione(req, varid=None):
if req.method == 'POST':
myform = nf.models.form_for_model(Previsione)(req.POST)

if myform.is_valid():
dati = myform.save(commit=False)

salva_rims = True
list_rims = req.POST.getlist('rims')

if varid is not None:
dati.id=varid
clean_path=re.sub('/[0-9]+/','',req.path)
else:
clean_path = req.path

# controlla se ci sono stati cambiamenti
# nel campo m2m
#
old_rims=list(dati.rims.all())
new_rims=Rim.objects.in_bulk(list_rims).values()
old_rims.sort()
new_rims.sort()

if old_rims == new_rims:
salva_rims = False

dati.save()

if salva_rims == True:
dati.rims = list_rims

return HttpResponseRedirect(clean_path)
else:
# method GET
#
if varid is None:
myform = nf.models.form_for_model(Previsione)()
else:
instance = get_object_or_404(Previsione, pk=varid)
myform = nf.models.form_for_instance(instance)()

return render_to_response('create_form.html', \
{ 'titolo': 'Archivio Previsioni',
'form': myform.as_table() })

tanks for the help ;-))) and sorry for my english !!

-- 
#include 
int main(void){char c[]={10,65,110,116,111,110,105,111,32,98,97,114,98,111,110,
101,32,60,104,105,110,100,101,109,105,116,64,116,105,115,99,97,108,105,110,101,
116,46,105,116,62,10,10,0};printf("%s",c);return 0;}

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: save many to many data

2007-02-06 Thread Antonio

* martedì 06 febbraio 2007, alle 20:10, Russell Keith-Magee wrote :

for the moment, I've resolved this way:

if req.method == 'POST':
myform = nf.models.form_for_model(Previsione)(req.POST)

if myform.is_valid():
dati = myform.save(commit=False)

salva_rims = True
list_rims = req.POST.getlist('rims')

if varid is not None:
dati.id=varid

old_rims=list(dati.rims.all())
new_rims=Rim.objects.in_bulk(list_rims).values()
old_rims.sort()
new_rims.sort()

if old_rims == new_rims:
salva_rims = False

dati.save()

if salva_rims == True:
dati.rims = list_rims

return HttpResponseRedirect('.')
else:

any better (and more elegant !! ;-)) idea ??

tanks in advance 

-- 
#include 
int main(void){char c[]={10,65,110,116,111,110,105,111,32,98,97,114,98,111,110,
101,32,60,104,105,110,100,101,109,105,116,64,116,105,115,99,97,108,105,110,101,
116,46,105,116,62,10,10,0};printf("%s",c);return 0;}

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



subclassing a Field

2007-01-31 Thread Antonio

hi all,

I've created a TYPE in PostgreSQL :

Composite type "utente.datirim"
Column|  Type
-+
nome| text
turno   | time without time zone
comandante  | text
disormeggio | time without time zone
arrivo  | time without time zone
fine| time without time zone
inizio  | time without time zone
attracco| time without time zone

I'm trying to create a new Field in Django to map a database table into a
model ... I've tryied to subclass Field, but I've got errors when I 'syncdb'.

There's a tutorial about this procedure ?? It's possible ??

tanks in advance ..

PS sorry for my english ...

-- 
#include 
int main(void){char c[]={10,65,110,116,111,110,105,111,32,98,97,114,98,111,110,
101,32,60,104,105,110,100,101,109,105,116,64,116,105,115,99,97,108,105,110,101,
116,46,105,116,62,10,10,0};printf("%s",c);return 0;}

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



anyone got Django running on Redhat ES in production?

2007-01-17 Thread antonio von carmoducci


Hi,

has anyone here got Django running on Redhat ES in production (live) in
a stable form?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: pure-HTTP deployment?

2006-12-21 Thread Antonio Cavedoni


On 12/21/06, Chad Whitacre <[EMAIL PROTECTED]> wrote:

Well, yeah. Mongrel is written in C though, so with a true Python
equivalent speed wouldn't be an issue.


So why not Mongrel itself, if it's written in C?

I must say I've been pretty well served by Apache, myself, so I'm not
sure I see a need.

Also, didn't GvR mention in his Mondrian Google Tech Talk that he's
using the wsgiref library (which should have a lightweight WSGI web
serve if I'm not mistaken)?

Cheers.
--
Antonio

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Session data remains after logout

2006-11-28 Thread Antonio Cavedoni

Hi Thierry,

On 11/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I store user data in sessions, for authenticated users.
> When the user logs out (I use the view shortcut
> django.contrib.auth.views.logout), his/her session data remains. Is there an
> easy way to remove all session data after a user logout? I would prefer to
> avoid wrapping the automated logout in a custom view, but looking at the code 
> I
> do not see any clue.

There's a daily_cleanup.py script in the /django/bin/ directory that
you can run daily (as a cronjob, maybe) to clean up expired session
data from the database. To view it online:

http://code.djangoproject.com/browser/django/trunk/django/bin/daily_cleanup.py

Cheers!
-- 
Antonio

--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Re: How do you use multiple forms on one page?

2006-11-28 Thread Antonio Cavedoni

On 11/28/06, enigmadude <[EMAIL PROTECTED]> wrote:
> Thank you for the info. I checked out the dev version and it looks like
> the attrs parameter is the sort of thing I was looking for, concerning
> the CSS issue. As for the multiple forms issue, I guess I'll have to
> come up with some classes or helper functions to keep that kind of
> stuff separated.

In the meantime, the way I solved this problem is to attach styles not
to the class of an input element but to its id in the CSS file. The
current form system generates ids like "id_fieldname" so you can hook
to that.

Cheers.
-- 
Antonio

--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Trac/Django on the same Apache instance

2006-11-10 Thread Antonio Cavedoni

On 10 Nov 2006, at 15:04, Rachel Willmer wrote:
> I have trac/django co-existing happily with the following config:
>
> They both run on separate virtual hosts under Apache2.

I have the same configuration (different Virtual Hosts, same Apache).

I dug some more, and apparently it’s the datatype of the date field  
that somehow gets mangled. If I change the template to print the  
literal variable instead of passing it to the date filter (which  
expects a datetime, I guess), then the I don’t get the AttributeError  
anymore.

But still, there must be something in the interaction between Sqlite,  
Windows, Trac, Django and mod_python that’s not correctly aligned.

Still digging, if someone has any clue as to what this might be  
related to, I’m all ears.

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Trac/Django on the same Apache instance

2006-11-10 Thread Antonio Cavedoni

Hello django-users,

I’m having a bit of a problem making Trac and Django coexist on the  
same Apache instance.

I have django.example.org and trac.example.org, both with their own  
PythonInterpreter directive set to “django” in the former case and  
“trac” in the other.

The problem is that if I load any page on the Trac site, one of the  
views in my Django site goes belly up and displays an AttributeError.  
The complete Traceback is at the bottom of this message. It looks  
like a template error, where the offending line reads:

{{ post.created|date:"d/m/Y" }}

Django complains with an “AttributeError at / 'str' object has no  
attribute 'day'”, but if I restart Apache and do not make any single  
request to the Trac site that view works just fine and that date gets  
formatted and displayed correctly.

As soon as I load any page on the Trac site, the Django site homepage  
(containing that template snippet) goes into AttributeError for any  
subsequent request. Other views keep on working fine on the Django site.

I’m running Django trunk HEAD, Apache 2.0.59 and mod_python 3.2.8 on  
a Windows 2000 server. Python 2.3.5, Trac 0.10.1, pysqlite-2.3.2.

Sorry, I’m a but stumped at the moment,

Cheers.
-- 
Antonio

[[[
Traceback (most recent call last):
File "c:\program files\django\django\template\__init__.py" in  
render_node
   706. result = node.render(context)
File "c:\program files\django\django\template\__init__.py" in render
   752. output = self.filter_expression.resolve(context)
File "c:\program files\django\django\template\__init__.py" in resolve
   565. obj = func(obj, *arg_vals)
File "c:\program files\django\django\template\defaultfilters.py" in date
   337. return format(value, arg)
File "c:\program files\django\django\utils\dateformat.py" in format
   252. return df.format(format_string)
File "c:\program files\django\django\utils\dateformat.py" in format
   27. pieces.append(str(getattr(self, piece)()))
File "c:\program files\django\django\utils\dateformat.py" in d
   115. return '%02d' % self.data.day

   AttributeError at /
   'str' object has no attribute 'day'
]]]


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django - CGI

2006-11-04 Thread Antonio Cavedoni

On 5 Nov 2006, at 0:44, Salvatore wrote:
> How can I run it as CGI ?

I’m quoting off this page:

http://code.djangoproject.com/wiki/ServerArrangements

[[[
Running Django as a traditional CGI is possible and would work the  
same as running any other sort of Python CGI script, but is generally  
not recommended.

With traditional CGI, the program which will be run -- in this case,  
Django plus a Django-powered application -- is loaded from disk into  
memory each time a request is served, which results in a significant  
amount of processing overhead and much slower responses. FastCGI and  
SCGI, in contrast, load the code only once -- when the server starts  
up -- and keep it in memory as long as the server is running,  
resulting in much faster responses.

If that hasn't put you off and you still need CGI, take a look at #2407.
]]]

#2407 points to this Trac ticket, where there are a couple of  
attachments to server Django apps as CGI:

http://code.djangoproject.com/ticket/2407

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is Django the right tool to use?

2006-11-04 Thread Antonio Cavedoni

Hello!

On 3 Nov 2006, at 2:41, elake wrote:
> I am working with a small team to create a new web site for our  
> church. We have found a site (http://www.prestonwood.org) that we  
> would like to use as a model and I am wondering if django is the  
> right tool for the job. I looked at other django powered sites  
> (http://www.ljworld.com/, http://www.lawrence.com/) and they have  
> some of the same features. What I am wanting to do is give login  
> access to the pastors and other leaders to update the pages that go  
> with their ministries.

That sounds very generic, so without having more context/details it’s  
a bit hard to say if Django fits the bill. But yes, you can have  
multiple people with their own login posting stuff via the Django  
admin interface.

> 1. Would it be best to do this all as one app or a separate app for  
> each page?

It depends very much on what you need to do. If all you need are HTML  
pages generated dynamically from the database, then a combination of  
the flatpages app and the admin interface might be a quick way to get  
you up and running without writing any code.

Here’s the flatpages documentation:

http://www.djangoproject.com/documentation/flatpages/

For something a bit more structured you might want to start writing  
an ad-hoc app of your own. In that case, the best way to get up to  
speed is by following the tutorial, which you’ll find here:

http://www.djangoproject.com/documentation/tutorial1/

> 2. Should there be one database instance or multiple (one for each  
> page/app)?

One database for the whole site is more than enough. There is work  
underway to make Django support more than one database at the same  
time, but it’s not something you sound you would need, from what I  
gather. I know I’ve certainly never needed it myself in the past few  
years.

> 3. Is the admin page the tool to use for the posters to use to  
> update the site?

The admin interface is intended as a quick way to get you up and  
running. So in a sense, yes, it’s the tool that most people use to  
update their Django-powered websites. That said, the admin is a  
generic and auto-generated editing interface so in some cases it  
might prove harder than something ad-hoc. In that circumstance, you  
could roll your own editing forms, if needed.

I hope this helps,

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Curious about 1.0 release.

2006-10-26 Thread Antonio Cavedoni

On 25 Oct 2006, at 16:11, sansmojo wrote:
> Thanks so much for the responses.  I am not scared of the fact that  
> Django is not at 1.0 - I need to convince others not to be :)
>
> Any ideas of how I might offer a proof (or strong evidence) of  
> 0.95's stability?

You might also want to point your boss towards this list which is  
pretty impressive considering the age of the project:

http://code.djangoproject.com/wiki/DjangoPoweredSites

FWIW: my little studio does pretty much all its web based work in  
Django these days. We’re about to launch a fashion site in Flash  
(yeah, I know) backed by Django and an e-commerce site, this time not  
in Flash, all in Django as well.

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: install svn downloaded apps

2006-10-22 Thread Antonio Cavedoni

On 22 Oct 2006, at 20:22, Picio wrote:
> Let's say you have someone putting his good django-powered app on  
> the web, under GPL.
> You achieve to download it with svn. What's next?

Put it somewhere Python can see it, add an entry with the app name to  
your settings.py file, in the INSTALLED_APPS tuple, then run either  
of these two commands:

   python manage.py install appname
   django-admin.py install appname

That should create the app’s database tables in your project’s  
database. You may also have to include the app’s URLconf in your main  
urls.py, by appending a line to the urlpatterns tuple, like:

   (r'^appname/', include('appname.urls'))

And that should be pretty much it. Things may slightly change  
depending on which app you’re trying to install, but that’s the bulk  
of the work.

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Syntax highlighter

2006-10-21 Thread Antonio Cavedoni

On 21 Oct 2006, at 12:04, Dirk Eschler wrote:
> Hello, does anyone use a generic syntax highlighter with Django? I  
> want to integrate something like GeSHi [1] in a blog-like  
> application and i try to find out where to start.

Incidentally, today I found out this Pygments library, which is a  
pure-Python syntax highlighter and looks very good from the outside  
(haven’t tried it yet):

http://pygments.pocoo.org/

This might be easier to integrate in a template tag, because you  
don’t need to call an external program to highlight some code, you  
just call the library function.

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Birthday

2006-10-13 Thread Antonio Cavedoni

On 13 Oct 2006, at 0:24, Guillermo Fernandez Castellanos wrote:
> I am trying to keep a birthday field in the database. But i am only
> interested in the day and month. Is there a way of using a DateField
> but only with day and month fields? Or should I use another solution?

A DateField looks like what you want: instead of storing just day and  
month, why not store also the year somebody was born? That way you  
can calculate stuff like “ZOMG, it’s your 27th birthday, you’re  
getting old!” :-)

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: SSL Middleware

2006-10-10 Thread Antonio Cavedoni

On 9 Oct 2006, at 21:07, mukappa wrote:
> One observation.  When redirecting to https elsewhere in the django  
> code I see this call, "django.http.get_host(request)" for resolving  
> the host portion.

Good call, that function checks for HTTP_X_FORWARDED_HOST instead of  
just request.META['HTTP_HOST'] as I’m doing.

I tweaked the SSL middleware to use it, thanks for the heads up!

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: SSL Middleware

2006-10-09 Thread Antonio Cavedoni

On 8 Oct 2006, at 5:27, [EMAIL PROTECTED] wrote:
> so now we can specify our urls for, say a login screen, and enjoy  
> ssl for that page only without explicit redirects. Also there is no  
> way for a user to request an unsecure version of that page if one  
> is not explicitly offered.

Yes, unless they find a way to work around the middleware, that is ;-)

This also means there is no ambiguity over the canonical URI of a page.

I’m thinking about modifying the HTTPS_PATHS setting to accept  
regular expressions instead of just strings, that would allow for  
even more flexibility. I’m still thinking, though, maybe it’s overkill.

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Django's target applications?

2006-10-06 Thread Antonio Cavedoni

On 6 Oct 2006, at 22:02, Paul Barry wrote:
> The social networking site with ~1 millions users, are you referring
> to grono.net?  The action of the login page is do-login.jsp and the
> Server header is "Apache-Coyote/1.1".  Melt points to a MovableType
> blog.

I have no idea about grono.net, but this is the result of the  
“Custard Melt” project (you stumbled upon the development blog):

http://www.cooltheplanet.net/

Cheers.
-- 
Antonio




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



SSL Middleware

2006-10-06 Thread Antonio Cavedoni

Hello everyone,

yesterday I came up with a Django middleware that has the potential  
to be actually useful!

I called it SSL Middleware, and what it does is take a tuple of paths  
(HTTPS_PATHS in the settings file) and redirect all the http://  
requests for paths starting with these values to their https://  
counterpart.

In reverse, if an https:// request is made on a path that does *not*  
start with one of the values in the tuple, that will be redirected to  
its http:// version.

The code is here:

http://unicoders.org/code/django/trunk/middleware/sslmiddleware.py

Cheers!
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



appointments in admin, possible?

2006-08-31 Thread Antonio Melé

Lets see if someone has already dealt with this problem and can help
me:
I want to administer appointments in admin. I have two classes:

===
class Client(models.Model):
   name = models.CharField(maxlength=30)
   company = models.CharField(maxlength=50)

class Appointment(models.Model):
   client = models.ForeignKey(Client,raw_id_admin=True)
   when = models.DateField(core=True)
   hour = models.TimeField(core=True)
===

There is a ManyToOne relationship: I can make many appointments with
every client and each appointment belongs only to one client. The
problem is I cannot make an appointment with a client the same date and
same time I've planned another appointment before. So I've got 2
troubles:

- When creating a new appointment showing only available dates/times
for selection.
(perhaps with AJAX when selecting a date showing only available times
for that date? but... how?)

- In the appointments list view showing available days for directly
adding an appointment that day (something like a timetable?)

Has anyone dealt with appointments in django admin? how?

Thank you!!!


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Django Books

2006-08-31 Thread Antonio Cangiano

zenx wrote:
> I don't know when it will be published, but a book is coming:
> http://www.amazon.com/gp/product/1590597257
> It is written by Adrian Holovaty and Jacob Kaplan-Moss (django
> developers) and as far as I know it will be also avaible for free
> download as PDF :D

That's excellent. If Adrian and Jacob need reviewers, I'm willing to
help. :)

Antonio
-- 
http://antoniocangiano.com
Zen and the Art of Ruby Programming


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Django templates editing mode for Emacs

2006-08-30 Thread Antonio Cavedoni

On 30 Aug 2006, at 18:13, James Bennett wrote:
> On 8/30/06, Antonio Cavedoni <[EMAIL PROTECTED]> wrote:
>> Before you start exposing my ignorance of Emacs Lisp to the world, I
>> will offer you that this is my first Emacs Lisp project *ever* (in
>> fact I don't even know Emacs Lisp at all), so please be gentle.
>
> First question: is this being built for GNU Emacs, XEmacs or both?

I’m using it with GNU Emacs at the moment, and the instructions I  
followed [1] don’t seem to mention XEmacs at all. But it’s fairly  
straightforward stuff, so maybe it works in XEmacs as well.

[1] http://two-wugs.net/emacs/mode-tutorial.html

Does anybody have XEmacs installed to test it?

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Django templates editing mode for Emacs

2006-08-30 Thread Antonio Cavedoni

Hello Djangoers,

I’ve started hacking on an editing mode for Django templates in  
Emacs. The only feature it has at the moment (and the reason I  
decided to do it) is syntax highlighting of Django template blocks  
and variables.

Before you start exposing my ignorance of Emacs Lisp to the world, I  
will offer you that this is my first Emacs Lisp project *ever* (in  
fact I don’t even know Emacs Lisp at all), so please be gentle.

You can find more about it over here:

http://code.djangoproject.com/wiki/Emacs

Cheers!
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Django Models, DRY, Scalability

2006-08-20 Thread Antonio Cavedoni

Hi Justin,

On 20 Aug 2006, at 18:43, bayerj wrote:
> As soon as I change my database schema, I have several possibilites  
> to get my app up again:
> (a) Change the model. Then drop the current db schema, fire up the  
> new one. Drawback: I lose my data.
> (b) Change the model and change the schema manually. Drawback: I am  
> repeating myself.
> (c) Make everything right from the start. Drawback: Can only be  
> reached asymptotical. (I won't argue about that :)

There has been lots of discussion about this very issue in the past  
few months, the situation you describe is what all of us have to deal  
with at the moment. The discussion has converged on this wiki page,  
where all the proposals have been argued:

  http://code.djangoproject.com/wiki/SchemaEvolution

There is a Google Summer of Code project to implement the proposals  
on that wiki page, mentored by Kenneth Gonsalves and implemented by  
Derek Anderson:

  http://code.google.com/soc/django/appinfo.html?csaid=CE83CE9BB3C461B3

A branch for working on schema evolution has been created by Jacob  
about one month ago, but no commit have been yet performed on it  
(that I know of, at least):

  http://code.djangoproject.com/browser/django/branches/schema-evolution

I am not aware of the status of the schema evolution implementation  
at the moment, but am very looking forward to it.

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Make Django cooexist with other webbapps

2006-08-17 Thread Antonio Cavedoni

Hi Peter,

On 17 Aug 2006, at 16:50, Peter Brink wrote:
> I need to make Django cooexist with mailman. As I understand it,  
> Django normally proccesses all requests which are sent to www.my- 
> domain.name. What I need to figure out is how to avoid that. I want  
> to get Django to ignore some URLs. For exampel, I would like to  
> have requests to www.my-domain.name/mailman to be handled completly  
> outside Django.

if you’re using Django with Apache and mod_python, it’s just a matter  
of adding something like this to your Apache configuration file,  
inside the options for the my-domain.name Virtual Host:


   SetHandler None


I use it also for other static files like robots.txt or favicon.ico,  
so they don’t have to pass through Django but get served right ahead  
from Apache.

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: order_with_respect_to : explanation?

2006-08-11 Thread Antonio Cavedoni

On 11 Aug 2006, at 11:13, Ivan Sagalaev wrote:
> This option creates an invisible field "_order" for manually  
> specifying  the order of child records of a single given parent  
> record. This is mostly visible in Admin where child records with  
> "edit_inline" appear in the same order that they were specified.

Fair enough, but if the field is invisible, how does one specifies  
said ordering? For example, if I have a list of 5 items, and I  
suddenly decide that item 4 should be on top of the list, how do I  
move it up?

Do I have to delete all the items and recreate the list from scratch  
with the proper order?
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Tagging.

2006-08-07 Thread Antonio Cavedoni

On 7 Aug 2006, at 15:23, Seth Buntin wrote:
> I have a Django project (almost complete) that needs to implement
> tagging.  […] I think I am going to have to write this
> from scratch but I don't know where to start.  Can someone point me in
> the right direction?

You may want to have a look at generic relations [1] and many to many- 
based tags, there’s a recipe on the wiki[2]:

[1] http://www.djangoproject.com/documentation/models/generic_relations/
[2] http://code.djangoproject.com/wiki/CookBookLabels

Cheers!
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Django model -> DOT converter

2006-08-06 Thread Antonio Cavedoni

On 6 Aug 2006, at 14:20, limodou wrote:
> And you can also add these code at the top of your script:
>
> import settings
> from django.core.management import setup_environ
> setup_environ(settings)
>
> So you don't need to setup DJANGO_SETTING_MODULE env variable any
> more. But the settings module should be settings.

I’d rather not do this as I would prefer not hardcoding the name of  
the settings module. I know it’s the default auto-generated one but I  
am used to rename the settings module to stuff like  
settings_development or settings_production etc.

> And other suggestion is: can methods be displayed in dot?

I *think* so, I’ll have a look.

Thanks again!
-- 
Antonio


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Django model -> DOT converter

2006-08-06 Thread Antonio Cavedoni

On 6 Aug 2006, at 14:25, Paul Sargent wrote:
> One thought about how ForeignKeys are represented. At the moment  
> you can't tell which field points to which model. I'm looking at  
> zyons-comment.pdf and can only tell the which model a ForeignKey  
> uses because the attribute names are sensible.

Yeah. Ideally the arrows should start from the attribute position,  
but they don’t because I haven’t looked up the proper DOT syntax yet.

Thanks anyway for the idea, I’ll try to get it in the code.

Cheers.
-- 
Antonio


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Django model -> DOT converter

2006-08-06 Thread Antonio Cavedoni

On 6 Aug 2006, at 6:08, limodou wrote:
> A very cool tool. And a question:
>
> It seems that it can not display OneToOne relationship.

I just fixed it to support both OneToOneFields and GenericRelations.  
I also added lots of samples from Ian’s Zyons project:

  http://code.djangoproject.com/wiki/DjangoGraphviz

Cheers!
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Django model -> DOT converter

2006-08-05 Thread Antonio Cavedoni

On 5 Aug 2006, at 3:40, Jeremy Dunck wrote:
> On 8/4/06, Antonio Cavedoni <[EMAIL PROTECTED]> wrote:
>> I have an initial, rather crude implementation of the Django model ->
>> DOT (the Graphviz file format) converter.
>
> Related:
> http://groups.google.com/group/django-users/browse_frm/thread/ 
> bde9e0928973f14a/08d286888aa781f5?tvc=1=en#08d286888aa781f5

Thanks for the pointer, Jeremy, I totally missed this one when it was  
posted. I merged some of Andrew Barilla’s ideas in my code (like not  
having to call modelviz for every model, but rather on a per-app  
basis), but I think his own is more complete.

For example, mine doesn’t yet generate arrows that start from a model  
property and get to the related model box. I’m just connecting the  
two boxes blindly.

Still, the way I see it, this should be more of a job for a batch  
script (maybe manage.py?) than for a Django app. That way the only  
thing that Django has to take care of is to generate the .dot files,  
then it’s somebody else’s job to take them and render them by  
importing in a desktop app like OmniGraffle o Graphviz itself and  
Django itself doesn’t have the dependency of the graphviz codebase  
just for this nifty trick.

> ...And I'm very close to having a graph generator for template  
> inheritance and load source.

Cool, would be very nice to see it!

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Django model -> DOT converter

2006-08-05 Thread Antonio Cavedoni

On 5 Aug 2006, at 2:44, Malcolm Tredinnick wrote:
> That's a lot of circles! :-)

Hehe, I told you it was crude! ;-)

> If you weren't aware of them, you might want to have a look at the  
> "record" style for Nodes in graphviz. They are useful for  
> displaying things like class diagrams or database tables. It might  
> make it easier to differentiate between your models and the fields  
> within the models.

Thanks Malcolm, I looked them up and now the modelviz uses the  
“record” style for models.

New code and examples:

  http://code.djangoproject.com/wiki/DjangoGraphviz

Cheers!
-- 
Antonio





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Django model -> DOT converter

2006-08-05 Thread Antonio Cavedoni

On 5 Aug 2006, at 3:05, Russell Keith-Magee wrote:
> Nifty! If I may make some comments (and this is intended as  
> constructive criticism, not an attempt to belittle your work)

Well, I was just procrastinating my university thesis anyway…

> - The graphs that are drawn are accurate, but don't differentate  
> between attributes and models

Fixed!

> - The data type of Attribute data type is not represented (but  
> would be helpful)

Fixed!!

> - The arrows describe both relationships between models and  
> relationships with attributes

Fixed!!!

> - Arrow direction doesn't describe relationship direction

Almost fixed ;-)

Thanks for the feedback and the comments, keep them coming!

Cheers.
-- 
Antonio




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Django model -> DOT converter

2006-08-04 Thread Antonio Cavedoni

Hello everyone,

I have an initial, rather crude implementation of the Django model ->  
DOT (the Graphviz file format) converter.

Some generated .dot files:

  http://cavedoni.com/2006/08/camera.dot
  http://cavedoni.com/2006/08/mincer.dot

The resulting Graphviz image:

  http://cavedoni.com/2006/08/camera.png
  http://cavedoni.com/2006/08/camera.pdf
  http://cavedoni.com/2006/08/mincer.png
  http://cavedoni.com/2006/08/mincer.pdf

The code is here (it’s not yet linked anywhere on the wiki, I didn’t  
know where to put it):

  http://code.djangoproject.com/wiki/DjangoGraphviz

Cheers!
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Off Topic: Mac software for database design?

2006-08-04 Thread Antonio Cavedoni

On 4 Aug 2006, at 19:35, Joseph Heck wrote:
> I believe it was a little custom script that generated a schema  
> model in OmniGraffle from the ruby code. Not 100% sure, but I  
> recall seeing one of the local ruby guys using it.

It’s probably off-topic and orthogonal to the MySQL modeling tool  
being requested by the original poster by I found this hack to be  
quite nice, maybe we could replicate something to the same effect for  
Django:

  http://www.hackdiary.com/archives/93.html

Cheers.
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Scandinavian characters in .po files and timezones

2006-07-30 Thread Antonio Cavedoni

On 30 Jul 2006, at 14:08, Mikko Nylén wrote:
> I tried to change all 'ä's with \xe4 and 'ö's with \xf6 and with  
> those I was
> able to make the messages compile. However, when trying to launch the
> built-in server, I get error saying "UnicodeDecodeError: 'utf8'  
> codec can't
> decode bytes in position 26-28: invalid data".
>
> I'm using Vim as my editor and I have set "set encoding=utf-8"  
> in .vimrc.
> Also, in the django.po I have line "Content-Type: text/plain;
> charset=utf-8". Is there something else I'm missing?

I don’t know much about Vim, but it appears your ö and ä are entered  
with an encoding different than UTF-8. Python then tries to decode  
your characters thinking they might be valid UTF-8, but they are not,  
so it raises the UnicodeDecodeError.

FYI: ä (LATIN SMALL LETTER A WITH DIAERESIS) in UTF-8 is \xc3\xa4,  
whereas \xe4 is its encoded form in ISO-8859-1/Latin-1 (and  
ISO-8859-10/Latin-6 as well, I haven’t looked at other encodings).

I googled a bit, and found this page [1] where it says that to set  
your Vim to the UTF-8 encoding you have to use the following command  
(note the column at the beginning):

:set encoding=utf-8

[1] http://www.vim.org/htmldoc/mbyte.html

> Also, I'd like to ask how different timezones should be handled? I'm
> building an application where it would be necessary for the users  
> to be able
> to choose their own timezone to display date and time information  
> correctly.
> One option would be, of course, to save the date and time returned by
> datetime.utcnow() to database and then for each user have setting
> "timezone", which would tell the offset from UTC in seconds.

Yeah, this way sounds reasonable to me.

You may also want to have a look at pytz:

http://pytz.sourceforge.net/

Cheers!
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Search Engine for Python and Django

2006-07-26 Thread Antonio Cavedoni

Hi Tom,

On 26 Jul 2006, at 1:22, Tom Dyson wrote:
> I'm about to release a pure-Python full-text indexer and search  
> engine called Dolphy.

I think your message got kind of lost in the thread, but wow, I’m  
*so* looking forward to see Dolphy!

> If you're interested in this project, please send me feature  
> requests, API suggestions (particularly with regards to Django  
> integration) and test data collections.

Well, I would cast a decided +1 for the Unicode/UTF-8 support. Care  
to elaborate on why it’s going to be so hard to have it in the 1.0  
release?

Cheers!
-- 
Antonio



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---