Re: Help with Custom model field and Custom validation for EmailField().

2012-11-03 Thread Dilip M
Hi Chris,

Thank you very much for your time on this. I am not able to make out on how
could I put this under clean() method. Ex: What does "you must call
the*parent class's clean()
"* mean in "if you would like to override the clean() method and maintain
the _default validation_, you must call the parent class's clean() method."

This clean() method will go in models.py? or forms.py? Any simple examples
would be of great help!

Many thanks...Dilip


On Fri, Nov 2, 2012 at 8:12 PM, Chris Pagnutti wrote:

> Ahh.  Just saw your link to overriding the clean() method.  So you could
> put all the same logic above into the clean() method instead.
>
>
> On Friday, November 2, 2012 4:36:20 AM UTC-4, Dilip M wrote:
>
>> Hi,
>>
>> I am new to Django. Went through docs before posting this.. I have a
>> model and form like this.
>>
>> models.py:
>>
>> class Recipients(models.Model):
>>  dev = models.EmailField()
>>  qa = models.EmailField()
>>  cc = models.MultipleEmailField()
>>
>> forms.py:
>>
>> class RecipientsForm(forms.**ModelForm):
>>
>> class Meta:
>> model = Recipients
>>
>>
>> Now I want to,
>>
>> 1. Add *additional* validation for models.EmailField(). Something like
>> check if email id entered exists in LDAP db.
>> 2. Create new model custom field MultipleEmailField(), which would split
>> emails separated by comma and uses modified validation of
>> models.EmailField() done in step 1.
>>
>> I am going through docs, but not able to figure out how to put things
>> together! Here is what I understood.
>>
>> MultipleEmailField() should go in /fields.py. But how to
>> make it to run default validation of models.EmailField() and than do custom
>> validation?
>>
>>
>> Any help appreciated..
>>
>>
>> Thanks. Dilip
>>
>

-- 
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: Help with Custom model field and Custom validation for EmailField().

2012-11-03 Thread Chris Pagnutti
I've never done it myself, but I think you'd just define the clean method
in your Form's class (i.e. in forms.py), and the first line in your clean()
method should call the parent classes, clean() method - to do this you need
to call the super() method, which is just regular python.  It think the
call would look something like this

super(YourFormClass,self).clean()

On Sat, Nov 3, 2012 at 6:55 AM, Dilip M  wrote:

> Hi Chris,
>
> Thank you very much for your time on this. I am not able to make out on
> how could I put this under clean() method. Ex: What does "you must call the
> * parent class's clean()"* mean in "if you would like to override the
> clean() method and maintain the _default validation_, you must call the
> parent class's clean() method."
>
> This clean() method will go in models.py? or forms.py? Any simple examples
> would be of great help!
>
> Many thanks...Dilip
>
>
>
> On Fri, Nov 2, 2012 at 8:12 PM, Chris Pagnutti 
> wrote:
>
>> Ahh.  Just saw your link to overriding the clean() method.  So you could
>> put all the same logic above into the clean() method instead.
>>
>>
>> On Friday, November 2, 2012 4:36:20 AM UTC-4, Dilip M wrote:
>>
>>> Hi,
>>>
>>> I am new to Django. Went through docs before posting this.. I have a
>>> model and form like this.
>>>
>>> models.py:
>>>
>>> class Recipients(models.Model):
>>>  dev = models.EmailField()
>>>  qa = models.EmailField()
>>>  cc = models.MultipleEmailField()
>>>
>>> forms.py:
>>>
>>> class RecipientsForm(forms.**ModelForm):
>>>
>>> class Meta:
>>> model = Recipients
>>>
>>>
>>> Now I want to,
>>>
>>> 1. Add *additional* validation for models.EmailField(). Something like
>>> check if email id entered exists in LDAP db.
>>> 2. Create new model custom field MultipleEmailField(), which would split
>>> emails separated by comma and uses modified validation of
>>> models.EmailField() done in step 1.
>>>
>>> I am going through docs, but not able to figure out how to put things
>>> together! Here is what I understood.
>>>
>>> MultipleEmailField() should go in /fields.py. But how to
>>> make it to run default validation of models.EmailField() and than do custom
>>> validation?
>>>
>>>
>>> Any help appreciated..
>>>
>>>
>>> Thanks. Dilip
>>>
>>
>  --
> 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.
>

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



Tutorial Help!

2012-11-03 Thread almel
I'm new to Django and trying out the tutorial and almost immediately 
getting stuck. I'm running django version 1.5, python version 2.7.2, and 
windows 7, and when I type into the command prompt 

django-admin.py startproject mysite

(I can't get rid of this green blob) The command runs, but it doesn't return 
anything. Any help, I'm sorry it's so vague but I don't know what's going on.

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



Django and HSQLDB

2012-11-03 Thread Abracadab
Hi, all. I'm building a Django app against a legacy HSQLDB database
(the existing user interface is built in OpenOffice Base). Is there a
way to use HSQLDB with Django? Alternatively, does anyone know if
there's a way to easily alter the existing database to any of the
existing Django/SQL interfaces?

Thank you,

Robert Orenstein
http://s7project.com/

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



Want help in Django basic configuration

2012-11-03 Thread sudeep gangal
hey guys hiii,
I am new to the django. I used the inspectdb command to copy the content of 
my db table made in mysql in django model.py. But that file doesn't contain 
any foreign key etc. 
I have declared primary keys and unique keys. But for relating 2 tables a 
foreign key is required. Can anyone suggest me a solution to the above 
defined problem

regards
Sudeep Gangal

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/oUxyO3ACBAMJ.
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.



selenium test for fallback page loaded from app cache when server is unavailable

2012-11-03 Thread Joao Coelho
Hi. I haven't been able to figure this one out. Trying to write an 
automated test that uses selenium.webdriver.firefox.webdriver

The manifest file has
FALLBACK:
/online.html /offline.html

So that at /online.html the browser displays the cached copy of 
/offline.html when the server is offline

Also, to simulate server unavailable for testing
/online.html returns a 200 response
/online.html?offline=1 returns 503

This all works fine when I browse manually
/online.html displays "I am online"
/online.html?offline=1 displays "I am a cached page"

I want the selenium test to get /online.html?offline=1 and see "I am a 
cached page" /offline.html
But it's only showing a blank page
I think it's stopping at the 503 and not loading from the app cache

def test_offline(self):
"""Simulate site being offline"""
self.selenium.get('%s%s' % (self.live_server_url, 
'/online.html?offline=1'))
self.assertIn('cached page', self.selenium.page_source)

How can I make it test this? Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/YrAnOOsSaKAJ.
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: Tutorial Help!

2012-11-03 Thread Daniel Roseman
On Saturday, 3 November 2012 09:21:19 UTC, almel wrote:

> I'm new to Django and trying out the tutorial and almost immediately 
> getting stuck. I'm running django version 1.5, python version 2.7.2, and 
> windows 7, and when I type into the command prompt 
>
> django-admin.py startproject mysite
>
> (I can't get rid of this green blob) The command runs, but it doesn't return 
> anything. Any help, I'm sorry it's so vague but I don't know what's going on.
>
>
What are you expecting it to return? It's not expected to actually return 
anything, but it sets up your project folders.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/QV5zmqfFbpIJ.
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: Want help in Django basic configuration

2012-11-03 Thread Daniel Roseman
On Saturday, 3 November 2012 05:55:21 UTC, sudeep gangal wrote:

> hey guys hiii,
> I am new to the django. I used the inspectdb command to copy the content 
> of my db table made in mysql in django model.py. But that file doesn't 
> contain any foreign key etc. 
> I have declared primary keys and unique keys. But for relating 2 tables a 
> foreign key is required. Can anyone suggest me a solution to the above 
> defined problem
>
> regards
> Sudeep Gangal
>

inspectdb is a best guess. It can't necessarily tell the difference between 
an IntegerField and a ForeignKey. But you can just change the generated 
code accordingly.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/UA0jtNOk5IkJ.
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.



mysql slow query flooded with set timestamp = ; commit

2012-11-03 Thread Yanhong Wu
I'm using django 1.3, recently I found  mysql slow query log was flooded by 
the following query:


# User@Host: user[user] @  [192.168.1.10]
# Thread_id: 2948369  Schema: db  Last_errno: 0  Killed: 0
# Query_time: 6.705106  Lock_time: 0.00  Rows_sent: 0  Rows_examined: 0 
 Rows_affected: 0  Rows_read: 0
# Bytes_sent: 11  Tmp_tables: 0  Tmp_disk_tables: 0  Tmp_table_sizes: 0
SET timestamp=1351951740;
commit;

There're several commits in every second, and each commit takes more than 5 
seconds.

Thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/xeZRM2pEzSMJ.
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: Tutorial Help!

2012-11-03 Thread lacrymol...@gmail.com
Wasn´t a 'myproject' directory created where you ran the command?


-Mensaje original-
De: almel
Enviados:  03/11/2012 06:21:19
Asunto:  Tutorial Help!

I'm new to Django and trying out the tutorial and almost immediately 
getting stuck. I'm running django version 1.5, python version 2.7.2, and 
windows 7, and when I type into the command prompt 

django-admin.py startproject mysite

(I can't get rid of this green blob) The command runs, but it doesn't return 
anything. Any help, I'm sorry it's so vague but I don't know what's going on.

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


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



django1.5 subclass AbstractUser, How to get a password-(re)set field in admin

2012-11-03 Thread Michael Muster
Hi again,

I have a subclass from AbstractUser

1 from django.contrib.auth.models import AbstractUser
2 from django.conf import settings
3
4 class cpUser(AbstractUser):
5 twitter = models.CharField(max_length=100)
6 def __unicode__(self):
7 return self.username

and 
AUTH_USER_MODEL = 'account.cpUser'
in my settings.py set.

How do i get a password field to set and reset
a password in my admin app?
Adding the password field to admin.py does obviously not
work as it enters plain text and not the hashed password.

1 from django.contrib import admin
2 class cpUserAdmin(admin.ModelAdmin):
3fields = ['twitter','username', 'first_name', 'last_name', 'password',]
4
5 admin.site.register(cpUser, cpUserAdmin)


Do i have to set a passwort field to the models.py or
can i geht that from the models which i "abstracted" from
(as done with username, first_name, last_name...)



Best regards
Michael






signature.asc
Description: Digital signature


Re: models.DecimalField with value 0 shows up as "0E-8" in admin forms by default. Is there a workaround?

2012-11-03 Thread Ben Roberts
If anyone down the road ends up looking for a solution to this, I worked it 
out via StackOverflow:

http://stackoverflow.com/questions/13163167/how-to-get-a-django-admin-form-field-for-a-models-decimalfield-with-value-0-to-n/13210775#13210775

On Wednesday, October 31, 2012 12:37:26 PM UTC-6, Ben Roberts wrote:
>
> I created a ticket for 
> this, since it really doesn't seem right for a Decimal field to be 
> using E notation in forms, but just for zeros.
>
> We use django admin as a client-facing backend, so we need to make it user 
> friendly. I have a model with a bunch of DecimalFields representing 
> nutritional data.
>
> The fields all look like this:
>
> g_carbs = DecimalField(max_digits=13, decimal_places = 8, null=True, 
> blank=True) 
>
> If the field is left blank, or if a non-zero value is provided, the admin 
> form looks and works great. For example, for a non-blank, non-zero value 
> like 10.5, it displays something like 10.5000, which is fine.
>
> The problem is that for any 0 values, the form field displays 0E-8 which, 
> although technically correct, is not going to cut it for clients, who are 
> not scientists or engineers for the most part and are unfamiliar with E 
> notation. We're using DecimalFields rather than FloatFields to avoid this 
> type of notation.
>
> I am not using a custom ModelForm or any custom admin tricks. Its just 
> what gets auto-rendered by django admin for that model. 
>
> I'm wondering if there is a work-around to this problem in the mean time.  
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/V_mnJiQhgnoJ.
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: selenium test for fallback page loaded from app cache when server is unavailable

2012-11-03 Thread Brad Pitcher
Are you having the selenium test go to online.html first like in your
manual test?
Maybe you need to have selenium hit offline.html first and cache that page?
On Nov 3, 2012 6:14 AM, "Joao Coelho"  wrote:

> Hi. I haven't been able to figure this one out. Trying to write an
> automated test that uses selenium.webdriver.firefox.webdriver
>
> The manifest file has
> FALLBACK:
> /online.html /offline.html
>
> So that at /online.html the browser displays the cached copy of
> /offline.html when the server is offline
>
> Also, to simulate server unavailable for testing
> /online.html returns a 200 response
> /online.html?offline=1 returns 503
>
> This all works fine when I browse manually
> /online.html displays "I am online"
> /online.html?offline=1 displays "I am a cached page"
>
> I want the selenium test to get /online.html?offline=1 and see "I am a
> cached page" /offline.html
> But it's only showing a blank page
> I think it's stopping at the 503 and not loading from the app cache
>
> def test_offline(self):
> """Simulate site being offline"""
> self.selenium.get('%s%s' % (self.live_server_url,
> '/online.html?offline=1'))
> self.assertIn('cached page', self.selenium.page_source)
>
> How can I make it test this? Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/YrAnOOsSaKAJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: GeometryField.geography = True Syntax Help GIS Model

2012-11-03 Thread JJ Zolper
Thanks for the reply.

I actually already have PostgreSQL.

So my question was pretty direct, or so I thought.

I'll try and spell this out again. So if I want to create a column in my 
database with type "geography" is this the syntax:

mpoly = models.MultiPolygonField(geography=true)

I cannot find an single example where we specify that we want the geography 
type to be used instead of using geometries.

All I need to know is if that is right? Is it a capitalized "true" so 
"TRUE" ?

Thanks so much,

JJ

On Friday, November 2, 2012 10:15:40 PM UTC-4, Dump wrote:
>
> First of all, you have to create a geo database. Postgis (a PostgreSQL 
> extension) is the best choice. 
>
> After that, you have to define some geography fields and import your data, 
> shape files (shp), etc. 
>
> GeoDjango Tutorial provides all the steps to get it done. 
>
> https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/
>
> If you are not familiar with geo concepts, I recommend to take a look at 
> http://geodjango.org/presentations/
>
> Hope that helps you
>
>
>
>
> On Fri, Nov 2, 2012 at 11:30 PM, JJ Zolper 
> > wrote:
>
>> Wait so does anyone know how to do this?
>>
>> I posted this a long time ago.
>>
>> How do I define a geography field? I need a geography column so I can 
>> perform geographic queries on it and the documentation doesn't give me 
>> a definitive way on how to do it.
>>
>> Would it be like:
>>
>> city = models.CharField(max_length=**50, GeometryField.geography = true)
>>
>> ???
>>
>>
>> On Saturday, October 20, 2012 1:22:32 PM UTC-4, JJ Zolper wrote:
>>>
>>> Hello everyone,
>>>
>>> So I've decided for my GeoDjango application I want WGS84 along with a 
>>> geography database column, rather than geometry.
>>>
>>> I was reading here:
>>>
>>> https://docs.djangoproject.**com/en/1.4/ref/contrib/gis/**
>>> model-api/#geography
>>>
>>> GeometryField.geography
>>>  
>>>
>>> If set to True, this option will create a database column of type 
>>> geography, rather than geometry. Please refer to the geography 
>>> type
>>>  section 
>>> below for more details.
>>>
>>>
>>> that to set up a new column as geography I had to 
>>> set GeometryField.geography = True.
>>>
>>> I am unsure of the syntax of how to do this? There was no example given. 
>>> Or where to properly place this line?
>>>
>>> Here is the model.py file I am working on. If you could tell me where to 
>>> fit this in that would be great?
>>>
>>>
>>> from django.contrib.gis.db import models
>>>
>>> class Artist(models.Model):
>>> name = models.CharField(max_length=**30)
>>> genre = models.CharField(max_length=**30)
>>> city = models.CharField(max_length=**60)
>>> state = models.CharField(max_length=**30)
>>> country = models.CharField(max_length=**50)
>>> website = models.URLField()
>>> objects = models.GeoManager()
>>>
>>> def __unicode__(self):
>>>return self.name
>>>
>>>
>>>
>>> Thanks so much,
>>>
>>> JJ
>>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/tWBJBDuXZzYJ.
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@googlegroups.com .
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> -- 
> Christiano Anderson | http://christiano.me/
> http://twitter.com/dump
>  

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



Re: Django and HSQLDB

2012-11-03 Thread Nick Apostolakis
On Sat, Nov 3, 2012 at 2:32 PM, Abracadab  wrote:

> Hi, all. I'm building a Django app against a legacy HSQLDB database
> (the existing user interface is built in OpenOffice Base). Is there a
> way to use HSQLDB with Django? Alternatively, does anyone know if
> there's a way to easily alter the existing database to any of the
> existing Django/SQL interfaces?
>
> Thank you,
>
> Robert Orenstein
> http://s7project.com/
>
>
I have used hsqldb in some of my projects alas not with django. It is
possible that you could fire up the hsqldb in server  mode with a command
like this

java -cp ./lib/hsqldb.jar org.hsqldb.Server -database.0 file:mydb -dbname.0
xdb

and then use the tool in odred to browse the database.

java -cp ./lib/hsqldb.jar org.hsqldb.util.DatabaseManagerSwing

after that, you can issue any sql command you like to export the database...
-- 
---
Nick Apostolakis
email:nicka...@oncrete.gr
Web Site: http://nick.oncrete.gr
---

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



tutorial first step. -ImportError: No module named django.core-

2012-11-03 Thread Francescos
Hello everyone,
Following the django tut I've sat up all the installation and reached the 
step where I had to run the command: django-admin.py startproject mysite
result: I receive the error specified in the subject.
I installed virtualenv (as said 
here)
 
and activate it before running the command django-admin.py startproject 
mysite.
Any suggestion for this problem? Thanks everyone.
Configuration:
- Windows 7 & cmd.exe
- Python2.7
- virtualenviroment at: C:\Python27\fra_env\
- PATH contains: C:\Python27\fra_env\Scripts
- django-admin.py is in C:\Python27\fra_env\Scripts AND 
C:\Python27\fra_env\Lib\site-packages\django\bin

I hope someone can help me!
Francesco

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/v_l9HV306cIJ.
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: planetdjango.org down?

2012-11-03 Thread Alexandre Provencio
Alright, its working again, thank you :)

On Fri, Nov 2, 2012 at 6:30 AM, Adomas Paltanavičius
 wrote:
> On Friday, October 26, 2012 3:35:45 PM UTC+1, Alexandre Provencio wrote:
>>
>> Can't access since yesterday :/
>
>
> I am looking into this. Should be back over the weekend.
>
> Thanks!
> Adomas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/1ANIKIBGcyAJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

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



Re: django1.5 subclass AbstractUser, How to get a password-(re)set field in admin

2012-11-03 Thread Russell Keith-Magee
On Sat, Nov 3, 2012 at 11:15 PM, Michael Muster <
michael.mus...@googlemail.com> wrote:

> Hi again,
>
> I have a subclass from AbstractUser
>
> 1 from django.contrib.auth.models import AbstractUser
> 2 from django.conf import settings
> 3
> 4 class cpUser(AbstractUser):
> 5 twitter = models.CharField(max_length=100)
> 6 def __unicode__(self):
> 7 return self.username
>
> and
> AUTH_USER_MODEL = 'account.cpUser'
> in my settings.py set.
>
> How do i get a password field to set and reset
> a password in my admin app?
> Adding the password field to admin.py does obviously not
> work as it enters plain text and not the hashed password.
>
> 1 from django.contrib import admin
> 2 class cpUserAdmin(admin.ModelAdmin):
> 3fields = ['twitter','username', 'first_name', 'last_name',
> 'password',]
> 4
> 5 admin.site.register(cpUser, cpUserAdmin)
>
>
> Do i have to set a passwort field to the models.py or
> can i geht that from the models which i "abstracted" from
> (as done with username, first_name, last_name...)
>
> You need to follow the instructions that are in the documentation.

https://docs.djangoproject.com/en/dev/topics/auth/#custom-users-and-django-contrib-admin

The key is that you can't just subclass admin.ModelAdmin -- you need to
subclass the existing Django admin class for Users
(django.contrib.auth.admin.UserAdmin) - that base class is what provides
all the special password handling etc for User models.

Yours,
Russ Magee %-)

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



Re: Django and HSQLDB

2012-11-03 Thread Russell Keith-Magee
On Sat, Nov 3, 2012 at 8:32 PM, Abracadab  wrote:

> Hi, all. I'm building a Django app against a legacy HSQLDB database
> (the existing user interface is built in OpenOffice Base). Is there a
> way to use HSQLDB with Django? Alternatively, does anyone know if
> there's a way to easily alter the existing database to any of the
> existing Django/SQL interfaces?
>
> Django has been designed to be database agnostic, so in theory, it can
adapt to any SQL database. However, you need to have a  backend that
services that database. For example, Django doesn't ship with support for
MSSQL or Firebird, but there are external libraries that support those
databases.

Unfortunately, I'm not aware of any existing project to build a HSQLDB
backend for Django.

Yours,
Russ Magee %-)

-- 
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: tutorial first step. -ImportError: No module named django.core-

2012-11-03 Thread Elena Williams
Hi Francesco,

What you're seeing is the most basic django/python error. It means that
your python can't find django from your current path.

You should start by checking for the simple things.

What happens when you try putting the following in your terminal?:
$ python

and then:
>>> import django

Also where is your django-admin.py file located?

Elena :)


---
Elena :)
@elequ
04022 90172



On Sun, Nov 4, 2012 at 6:24 AM, Francescos wrote:

> Hello everyone,
> Following the django tut I've sat up all the installation and reached the
> step where I had to run the command: django-admin.py startproject mysite
> result: I receive the error specified in the subject.
> I installed virtualenv (as said 
> here)
> and activate it before running the command django-admin.py startproject
> mysite.
> Any suggestion for this problem? Thanks everyone.
> Configuration:
> - Windows 7 & cmd.exe
> - Python2.7
> - virtualenviroment at: C:\Python27\fra_env\
> - PATH contains: C:\Python27\fra_env\Scripts
> - django-admin.py is in C:\Python27\fra_env\Scripts AND
> C:\Python27\fra_env\Lib\site-packages\django\bin
>
> I hope someone can help me!
> Francesco
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/v_l9HV306cIJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Location of non-app-specific static files?

2012-11-03 Thread Ryan
Hi,

I have been wondering where people put their non-app-specific static files 
in their django projects?  For example, the base css file that applies to 
all pages across the project or perhaps the jquery file?

Currently I have the following structure:

.
├── app
│   ├── __init__.py
│   ├── models.py
│   ├── static
│   │   └── app
│   │   ├── css
│   │   ├── img
│   │   └── js
│   ├── templates
│   │   └── app
│   ├── tests.py
│   └── views.py
├── manage.py
└── mysite
├── __init__.py
├── settings.py
├── static
├── templates
├── urls.py
└── wsgi.py

My STATIC_ROOT setting points to the ./mysite/static directory as this is 
where I would like collectstatic to dump all the static files for 
deployment, however this is also the obvious place (for me anyway) to place 
non-app-specific static files as they apply to the project as a whole like 
the templates directory at this level.

Does any one have any input on this?

Thanks,

Ryan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/4H39KqmnTugJ.
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: Location of non-app-specific static files?

2012-11-03 Thread Elena Williams
Hi Ryan,

I'm not sure if it helps but not long ago I found this by Simon Willison on
Quora:
http://www.quora.com/Django/How-do-you-organize-the-code-in-your-Django-project

Cheers,
Elena :)

---
Elena :)
@elequ
04022 90172



On Sun, Nov 4, 2012 at 10:23 AM, Ryan  wrote:

> Hi,
>
> I have been wondering where people put their non-app-specific static files
> in their django projects?  For example, the base css file that applies to
> all pages across the project or perhaps the jquery file?
>
> Currently I have the following structure:
>
> .
> ├── app
> │   ├── __init__.py
> │   ├── models.py
> │   ├── static
> │   │   └── app
> │   │   ├── css
> │   │   ├── img
> │   │   └── js
> │   ├── templates
> │   │   └── app
> │   ├── tests.py
> │   └── views.py
> ├── manage.py
> └── mysite
> ├── __init__.py
> ├── settings.py
> ├── static
> ├── templates
> ├── urls.py
> └── wsgi.py
>
> My STATIC_ROOT setting points to the ./mysite/static directory as this is
> where I would like collectstatic to dump all the static files for
> deployment, however this is also the obvious place (for me anyway) to place
> non-app-specific static files as they apply to the project as a whole like
> the templates directory at this level.
>
> Does any one have any input on this?
>
> Thanks,
>
> Ryan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/4H39KqmnTugJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



RE: Help with Custom model field and custom validation for EmailField()

2012-11-03 Thread bb6xt
Hi,
If all u nid is a field whose value is a comma separated list of emails den u 
dont nid a custom field at all. All u nid is a gud ol CharField. Just set it 
like so:
emails=models.CharField(max_length=500, validators=[multi_email_validator,]).
here is what multi_email_validator looks like:
from django.core.validators import EmailValidator
from django.core.exceptions import ValidationError
def multi_email_validator(value):
if value and "," in value:
for v in value.split(",").strip():
try:
EmailValidator().__call__(v)
except: raise ValidationError("%s is not a valid email" % v)
else:
try:
EmailValidator().__call__(value)
except: raise ValidationError("%s is not a valid email" % value)
with dis aproach and using modelforms u dont nid to validate in forms or views 
cos calling form.is_valid with call model field validators too. Hope dis helps.
abraham.

--
Sent from my mobile device

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