Re: Partner

2021-06-23 Thread Arthur Obo Nwakaji
Hello, I am interested and love to know more about this opportunity. I am
well experienced in Django and DRF.

On Wed, 23 Jun 2021, 4:19 PM ericki...@gmail.com  hello guys am looking for any one good at Django and DRF i have couple of
> personal projects which needs this tech spec am not good at them if any one
> is interested plz i will be grateful
>
> --
> 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/b21836a0-1b17-4467-9b3c-5aba128e2c23n%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/CAGOrV0c%2BfTqrvFdsPUXnbrYa27ZU8BppN%3Dok2Dna%2Be8ky0Z9%3DA%40mail.gmail.com.


Re: Making a rather small web app, is Django right for it?

2021-05-25 Thread Arthur Obo Nwakaji
Then you can go with Django then.

On Tue, 25 May 2021, 2:12 PM Devin Prater  It's more of a nice-to-have for work. But yeah, it'll not be a very large
> project.
>
> Devin Prater
>
> Technical Assistant
>
>
> 256 761-3423
>
> [image: Alabama Institute for Deaf and Blind]
>
> P.O. Box 698 | 1105 Fort Lashley Ave.
>
> Talladega, AL 35161
>
> www.aidb.org
> [image: Facebook] Discover how we’re limitless.
> 
>
>
>
> On Tue, May 25, 2021 at 12:54 AM Antonis Christofides <
> anto...@antonischristofides.com> wrote:
>
>> It's hard to say. While Django *is* suitable, it's also large. If you
>> don't know it already, you might not want to learn it just for this. It's
>> possible Flask would be a better choice, since it's smaller and (I think)
>> easier. (Note: I'm a Django developer, and I'm not a Flask developer.)
>>
>> So I think it's mostly a question of what you want: Why do you want to do
>> this project? Is it commercial? Is it a hobby? Is it something you do
>> because you find it appealing? If it's something like a hobby, pick up
>> whatever seems more fun to you.
>>
>> Regards,
>>
>> Antonis
>>
>> Antonis Christofides
>> +30-6979924665 (mobile)
>>
>>
>>
>> On 24/05/2021 17.37, Devin Prater wrote:
>>
>> Hi all. I am a rather new Python learner, although I've made the
>> following script:
>>
>> https://github.com/prater-devin/src/blob/main/lunch/lunch.py
>>
>> I want to turn this into a central place where students can get not just
>> the lunch menu, but also other menus, upcoming events, things like that,
>> but not much more than that. So, in order to bypass the need for submitting
>> to the App Store because this isn't that big of an app, I decided to go
>> with web development instead. Since I already know Python, enough to make
>> that simple program at least, I thought I'd just use Django to make this.
>>
>> Now, I've also tried using Beeware to make an actual app, and that seems
>> easy compared to getting started with Django, but I don't want to disregard
>> Django just because Beeware is easier. Plus Beeware doesn't seem to have
>> web app creation support yet. So, any ideas? How hard would it be to take
>> something like that simple code, probably for the backend more than
>> frontend, and enhance it, mainly adding more requests to a URL, then
>> getting text using BS4, then showing it on the app? I imagine tabs at the
>> bottom of the screen for "menus", "vending machines", and "events and
>> news." Stuff like that, then the main content in the middle, then buttons
>> at the top to change between menu sources on the menus tab and such. So,
>> not that much interaction I'd think. So, what do you all think? Thanks for
>> any help.
>>
>> Devin Prater
>>
>> Technical Assistant
>>
>>
>> 256 761-3423
>>
>> [image: Alabama Institute for Deaf and Blind]
>>
>> P.O. Box 698 | 1105 Fort Lashley Ave.
>>
>> Talladega, AL 35161
>>
>> www.aidb.org
>> [image: Facebook] Discover how we’re limitless.
>> 
>>
>> --
>> 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/CAKXtajAeZPSpgZg9a38YtCksi4N7VF51DJYxWAQ1K0P3V%3D-P_A%40mail.gmail.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/90a0185c-d744-826c-c1b7-d459d23d18a3%40antonischristofides.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/CAKXtajAiCKrzXgZ6Y8bZFQZggpeE_N3DaFSTwunTjY5Y%3DgqtuA%40mail.gmail.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 

Re: Making a rather small web app, is Django right for it?

2021-05-25 Thread Arthur Obo Nwakaji
So right, flask is easier and help you get job done faster. But if you want
to build a more scalable application for an enterprise Django is your
friend.

On Tue, 25 May 2021, 6:55 AM Antonis Christofides <
anto...@antonischristofides.com wrote:

> It's hard to say. While Django *is* suitable, it's also large. If you
> don't know it already, you might not want to learn it just for this. It's
> possible Flask would be a better choice, since it's smaller and (I think)
> easier. (Note: I'm a Django developer, and I'm not a Flask developer.)
>
> So I think it's mostly a question of what you want: Why do you want to do
> this project? Is it commercial? Is it a hobby? Is it something you do
> because you find it appealing? If it's something like a hobby, pick up
> whatever seems more fun to you.
>
> Regards,
>
> Antonis
>
> Antonis Christofides
> +30-6979924665 (mobile)
>
>
>
> On 24/05/2021 17.37, Devin Prater wrote:
>
> Hi all. I am a rather new Python learner, although I've made the following
> script:
>
> https://github.com/prater-devin/src/blob/main/lunch/lunch.py
>
> I want to turn this into a central place where students can get not just
> the lunch menu, but also other menus, upcoming events, things like that,
> but not much more than that. So, in order to bypass the need for submitting
> to the App Store because this isn't that big of an app, I decided to go
> with web development instead. Since I already know Python, enough to make
> that simple program at least, I thought I'd just use Django to make this.
>
> Now, I've also tried using Beeware to make an actual app, and that seems
> easy compared to getting started with Django, but I don't want to disregard
> Django just because Beeware is easier. Plus Beeware doesn't seem to have
> web app creation support yet. So, any ideas? How hard would it be to take
> something like that simple code, probably for the backend more than
> frontend, and enhance it, mainly adding more requests to a URL, then
> getting text using BS4, then showing it on the app? I imagine tabs at the
> bottom of the screen for "menus", "vending machines", and "events and
> news." Stuff like that, then the main content in the middle, then buttons
> at the top to change between menu sources on the menus tab and such. So,
> not that much interaction I'd think. So, what do you all think? Thanks for
> any help.
>
> Devin Prater
>
> Technical Assistant
>
>
> 256 761-3423
>
> [image: Alabama Institute for Deaf and Blind]
>
> P.O. Box 698 | 1105 Fort Lashley Ave.
>
> Talladega, AL 35161
>
> www.aidb.org
> [image: Facebook] Discover how we’re limitless.
> 
>
> --
> 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/CAKXtajAeZPSpgZg9a38YtCksi4N7VF51DJYxWAQ1K0P3V%3D-P_A%40mail.gmail.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/90a0185c-d744-826c-c1b7-d459d23d18a3%40antonischristofides.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/CAGOrV0c3OfmEAQ3Qkyu4pjBV3CSyRkykDtDe5Z9LuPWL0CcowA%40mail.gmail.com.


Re: Making a rather small web app, is Django right for it?

2021-05-24 Thread Arthur Obo Nwakaji
Hello, django is an awesome tool in the hands of a great developer who know
how to use it. You're on the right track because django is great for
building scalable web applications and restful APIs. I am always ready to
do my best to help as I can in the django community. If you need any
assistance or questions, you can reach out to me.

On Mon, 24 May 2021, 9:09 PM Devin Prater  Hi all. I am a rather new Python learner, although I've made the following
> script:
>
> https://github.com/prater-devin/src/blob/main/lunch/lunch.py
>
> I want to turn this into a central place where students can get not just
> the lunch menu, but also other menus, upcoming events, things like that,
> but not much more than that. So, in order to bypass the need for submitting
> to the App Store because this isn't that big of an app, I decided to go
> with web development instead. Since I already know Python, enough to make
> that simple program at least, I thought I'd just use Django to make this.
>
> Now, I've also tried using Beeware to make an actual app, and that seems
> easy compared to getting started with Django, but I don't want to disregard
> Django just because Beeware is easier. Plus Beeware doesn't seem to have
> web app creation support yet. So, any ideas? How hard would it be to take
> something like that simple code, probably for the backend more than
> frontend, and enhance it, mainly adding more requests to a URL, then
> getting text using BS4, then showing it on the app? I imagine tabs at the
> bottom of the screen for "menus", "vending machines", and "events and
> news." Stuff like that, then the main content in the middle, then buttons
> at the top to change between menu sources on the menus tab and such. So,
> not that much interaction I'd think. So, what do you all think? Thanks for
> any help.
>
> Devin Prater
>
> Technical Assistant
>
>
> 256 761-3423
>
> [image: Alabama Institute for Deaf and Blind]
>
> P.O. Box 698 | 1105 Fort Lashley Ave.
>
> Talladega, AL 35161
>
> www.aidb.org
> [image: Facebook] Discover how we’re limitless.
> 
>
> --
> 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/CAKXtajAeZPSpgZg9a38YtCksi4N7VF51DJYxWAQ1K0P3V%3D-P_A%40mail.gmail.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/CAGOrV0fcNz5ByPfkuQZb3qHXDzgVPvX65Mq_UbdbKP%2BOtQiuyQ%40mail.gmail.com.


Retrieving csrftoken value with CSRF_USE_SESSIONS enabled

2020-10-01 Thread Arthur Rio
Hi,

While working on turning on CSRF_USE_SESSIONS for a project, I noticed that
the documentation recommends the following to retrieve the value:

```
{% csrf_token %}

const csrftoken =
document.querySelector('[name=csrfmiddlewaretoken]').value;

```

I am wondering why not doing the following instead?

```

const csrftoken = “{{ csrf_token }}";

```

Is there some other security benefits I’m not thinking of?

Regards

Arthur

-- 
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/CADOBPEHHoi8yY8cxyMa5jXjcz60MDFiOFW338g%2BAGwqBnEb84A%40mail.gmail.com.


Re: Study and project partner(s) needed

2020-02-14 Thread Samuel Arthur
arthursamuel...@gmail.com

On Fri, 14 Feb 2020 at 16:45 Oluwatobi Adefami 
wrote:

> Hi, I'm interested. How can I reach you?
>
> On Fri, Feb 14, 2020, 17:15 Akorede Habeebullah  wrote:
>
>> Hi guys,
>>
>> I've been learning Django on a solo for a while now and I'm really in
>> need of a Programmer friend/partner who we can always learn together, build
>> projects together. This will really benefit both sides greatly.
>> I am a person you'll really love to make friend with. Interested
>> individuals should pls signify.
>>
>> 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/6d4ed94c-3864-4c5b-9f9e-5df7b6a77cdd%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/6d4ed94c-3864-4c5b-9f9e-5df7b6a77cdd%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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/CACRqaeXWZJ3Mk4-06gURT2rpNOvcpmfrTC%3DQDSpFZJ5pufLEWg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACRqaeXWZJ3Mk4-06gURT2rpNOvcpmfrTC%3DQDSpFZJ5pufLEWg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
-- 
Samuel Arthur
Phone Number : 0574799421
Home: 093878

-- 
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/CAMxToKQo2qX9Lc53ov9rbjq1Xgp968AST4G__7pvTgV_KgSRdA%40mail.gmail.com.


Re: Study and project partner(s) needed

2020-02-14 Thread Samuel Arthur
Hello there, I'm interested 


On Friday, February 14, 2020 at 4:16:13 PM UTC, Akorede Habeebullah wrote:
>
> Hi guys, 
>
> I've been learning Django on a solo for a while now and I'm really in need 
> of a Programmer friend/partner who we can always learn together, build 
> projects together. This will really benefit both sides greatly. 
> I am a person you'll really love to make friend with. Interested 
> individuals should pls signify. 
>
> 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/5bb6c3e3-5958-4189-aadc-ef8ebe550ea3%40googlegroups.com.


Re: ElementTree problem saving images

2019-10-24 Thread Arthur Antoine
The image urls are being set to None on every iteration where the id 
doesn't match. Try setting all of the urls to None before the loop, then 
remove the else blocks.

On Thursday, October 24, 2019 at 11:28:00 AM UTC-4, Nuno Vieira wrote:
>
> Hi,
>
> i receive an xml file and i am parsing the values and sving them to 
> database.
>
>> XML Example:
>
> ...
> ...
> ...
> 
> 9896
> 2019-07-11 13:12:09
> BC30401
> 895000
> EUR
> sale
> 0
> 0
> 0
> 
> 915
> 
> Villa
> 
> 37.134720
> -8.020436
> 
> optional location detail
> Vilamoura
> Algarve
> Portugal
> 4
> 3
> 1
> 
> 
> 
> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7064.jpg
> 
> 
> 
> 
> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7065.jpg
> 
> 
> 
> 
> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7066.jpg
> 
> 
> 
> 
> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7067.jpg
> 
> 
> 
> 
> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7068.jpg
> 
> 
> 
> 
> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7069.jpg
> 
> 
> 
> 
> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7071.jpg
> 
> 
> 
> 
> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7072.jpg
> 
> 
> 
> 
> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7073.jpg
> 
> 
> 
> 
> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7075.jpg
> 
> 
> 
> 
> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7077.jpg
> 
>
>> 
>
>
> It´s all working ok but with images its a litle confused because i can 
> only save the first and the last image. If a property have 12 pictures i 
> can only save the picture nr 1 and picture nr 12, if the property have 8 
> pictures i can only save picture nr1 and picture nr 8. It´s weird!
>
> My code to get the pictures url:
> img = props.find('images')
>
> for child in img:
>
> if child.get('id') == '1':
>img_main_url = child.find('url'
> ).text
>
>if child.get('id') == '2':
>
>img_1_url = child.find('url').text
>else:
>img_1_url = None
>if child.get('id') == '3':
>img_2_url = child.find('url').text
>else:
>img_2_url = None
>if child.get('id') == '4':
>img_3_url = child.find('url').text
>else:
>img_3_url = None
>if child.get('id') == '5':
>img_4_url = child.find('url').text
>else:
>img_4_url = None
>
>
> I could use a litle help from someone more experienced in django.
>
> Thanks for your help
>
>

-- 
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/ccd85c4c-4742-4a3f-baf5-0e06c075d6c4%40googlegroups.com.


need to upgrade django1.4.5-->django1.5, but apt-get install django tells me i'm running latest version

2015-06-01 Thread arthur sherman
i get the following errors in the apache2 error.log:

VersionConflict: (Django 1.4.5 (/usr/lib/python2.7/dist-packages), 
Requirement.parse('Django>=1.5'))

but when i attempt upgradinging django apt-get install reports that i'm at 
the latest version:
 apt-get install python-django
Reading package lists... Done
Building dependency tree   
Reading state information... Done
python-django is already the newest version.
The following package was automatically installed and is no longer required:
  libmysqlclient16
Use 'apt-get autoremove' to remove it.

any suggestions?

-- 
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/7fd56253-482e-4cdb-8a26-c98d9d03805c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


how to initiate an interactive python script from an html cgi?

2015-03-24 Thread arthur sherman
i have a python script which currently runs in a shell cli.
i'd like to initiate this script from a web page.
the closest i got was to have the output displayed on the webpage (w/o 
linefeeds),
but it crashed when requesting input via raw_input().
i simply did 'exec python-script-name' from the cgi.
ok, i now understand why it crashed and why the output is displayed 
primitively
it's  now my understanding that django can help.
where's the best place to start?
tnx
ams

-- 
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/83facec0-80cd-4b6d-bd5c-ec5d6798056c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Config: DB or git?

2014-09-30 Thread Arthur Alvim
There's a really nice project called python-decouple. (
https://github.com/henriquebastos/python-decouple/)

You can store you vars on .ini or .env files and ignore then on git.
Install

pip install python-decouple

<https://github.com/henriquebastos/python-decouple/#usage>Usage

On your settings.py.

   1.

   Import the config object:

   from decouple import config

   2.

   Retrieve the configuration parameters:

   SECRET_KEY = config('SECRET_KEY')DEBUG = config('DEBUG',
default=False, cast=bool)EMAIL_HOST = config('EMAIL_HOST',
default='localhost')EMAIL_PORT = config('EMAIL_PORT', default=25,
cast=int)





-- Atenciosamente
-  Arthur Alvim [ arth.al...@gmail.com ]

IFPE - Tecnólogo em Análise e Desenvolvimento de Sistemas
UFPE CIn - Mestre em Ciência da Computação

"Partilha os teus conhecimentos. É a forma de conseguires a imortalidade."
Dalai Lama


2014-09-30 14:30 GMT-03:00 Vernon D. Cole <vernondc...@gmail.com>:

> 12-factor is all the rage, and they have some very good ideas that ought
> to be followed.  But insisting that environment variables are the only
> correct way of storing settings, is, well, just plain wrong. [ Note: I have
> 40 years of experience, I recognize a fad when I see it. ] All of those
> values have to get _into_ the environment variables somehow, and that means
> that somewhere there is a disk file which has them in it.  Is it really
> safer to have them written in some language other than Python so that you
> have to have a special program to read them?  I doubt it.
>
> So my preference is to use a structured settings arrangement, where the
> file which is referenced by DJANGO_SETTINGS_MODULE imports settings.py (not
> vice-verso).
> That outside settings module, called salt_settings.py on my systems, is
> written by the SaltStack "state" which deploys my server.
> The same "state" also creates the database, the nginx configulation, and
> the uWSGI configuration, so the same passwords, sockets, database names,
> etc, are used on both sides of an interface.
> The sensitive data, such as passwords, are kept in a Salt Pillar
> structure, which is in a (highly protected) repo, separate from the salt
> "state" files, which are in a separate repo from the application.  Three
> purposes, three repos.
>
> Why SaltStack and not one of the other configuration engines mentioned
> above?  Because Salt, like django, is written using a Python templating
> system.  You do not program your configuration in Ruby (Puppet and Chef) or
> Python (fabric), but lay it out in nice, readable, white-space sensitive
> YAML files, with Jinja templates where needed.
> I have an over-simplified example at
> https://github.com/eHealthAfrica/salt_demo
> --
> Venon Cole
>
>
> On Monday, September 29, 2014 2:05:37 PM UTC+1, guettli wrote:
>>
>> Hi,
>>
>> of course we separate data from code:
>>
>>   - code belongs into version control (git)
>>   - data belongs into a database (postgres)
>>
>> But where does configuration belong?
>>
>> Since I am a developer I like version control.
>>
>> But the longer I think about this question, I think
>> the perfect configuration for an app just contains
>> one entry: How to connect to the DB.
>>
>> Sooner or later you want things to editable via an admin interface.
>>
>> And if you look at big systems like SAP. There is only very little config
>> in files.
>>
>> I think config should be done in the database, not files. It is hard to
>> accept
>> this, since version control is great for files, and not so good for
>> databases,
>> but I think it is the way to go.
>>
>> What do you think?
>>
>>Thomas
>>
>>
>>
>> --
>> Thomas Güttler
>> http://thomas-guettler.de/
>>
>  --
> 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/f518e9ed-e22d-49d6-8f0f-5ef8981b6d88%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f518e9ed-e22d-49d6-8f0f-5ef8981b6d88%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANjJ3%3DMTW0euFcQiv3QPTV4oidHWay91uK7oviAU8_YF71CN4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django-socketio fails - even in example project - appreciate a clue

2014-08-03 Thread Arthur Alvim
I was trying to do some example too but using gevent+socket.io .


-- Atenciosamente
-  Arthur Alvim [ arth.al...@gmail.com ]

IFPE - Tecnólogo em Análise e Desenvolvimento de Sistemas
UFPE CIn - Mestre em Ciência da Computação

"Partilha os teus conhecimentos. É a forma de conseguires a imortalidade."
Dalai Lama



2014-08-03 12:57 GMT-03:00 esatterwh...@wi.rr.com <esatterwh...@wi.rr.com>:

> The error sound pretty simple. You user doesn't have the required
> permission to bind to port 834. You,ll either need to run it a sudden or
> change the port it runs on to a higher port.
>
> --
> 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/1dc6fba7-986d-4f43-b4d1-77e316375348%40googlegroups.com
> .
> 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/CANjJ3%3DMtB7cOq%3Dgx54uH8o3v3RQeQ2XSuhAT2ezajexN2KX_8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django GenericRelation not working

2014-01-03 Thread arthur . muchir
Thanks Daniel for your answer.

I didn't know I could use a simple FK in this case. I will try using it. I 
didn't want to directly inherit from GenericMedia because I don't want to 
merge ContentType datas (content_type, content_object, etc.) with my own 
Media datas (description, link, ...)

So far I just see a problem I'm going to meet in my save method :

I will change my Media model to this one : 

class Media(models.Model):
description = models.CharField(blank = True, max_length = 500)
link= models.URLField(blank = True)
generic_fk  = models.OneToOneField(GenericMedia)

class Meta:
abstract = True

def __unicode__(self):
return u"%s" % os.path.basename(self.url.name)

def save(self, *args, **kwargs):
super(Media, self).save(*args, **kwargs)
generic_link = GenericMedia(content_object = self)
generic_link.save()
generic_fk = generic_link.id


But I think I will have a problem with the save method, Media have a FK to 
GenericMedia but GenericMedia have to Media, so how could I adapt ? Thanks !

Le jeudi 2 janvier 2014 22:09:22 UTC+1, arthur...@gmail.com a écrit :
>
> I have the following model in my app, using the content-type django 
> framework in version 1.6.1 :
>
> class GenericMedia(models.Model):
> limit   = models.Q(model = 'Image') | models.Q(model = 'Video') | 
> models.Q(model = 'Other')
> content_type= models.ForeignKey(ContentType, limit_choices_to = limit)
> object_id   = models.PositiveIntegerField()
> content_object  = generic.GenericForeignKey('content_type', 'object_id')
>
> def __unicode__(self):
> return u"%s" % os.path.basename(self.content_object.url.name)
>
> def instance(self):
> return self.content_object.__class__.__name__
>
> class Media(models.Model):
> description = models.CharField(blank = True, max_length = 500)
> link= models.URLField(blank = True)
> genericFK   = generic.GenericRelation(GenericMedia, 
> content_type_field='content_type', object_id_field='object_id')
>
> class Meta:
> abstract = True
>
> def __unicode__(self):
> return u"%s" % os.path.basename(self.url.name)
>
> def save(self, *args, **kwargs):
> super(Media, self).save(*args, **kwargs)
> generic_link = GenericMedia(content_object = self)
> generic_link.save()
>
> class Image(Media):
> imgW = models.PositiveSmallIntegerField()
> imgH = models.PositiveSmallIntegerField()
> url  = models.ImageField(upload_to = 'mediamanager', height_field = 
> 'imgH', width_field = 'imgW')
>
> Everythings works fine, excepts the GenericRelation in my abstract Media 
> Class.
>
> In django documentation it is said that :
> If you delete an object that has a GenericRelation, any objects which have a 
> GenericForeignKey pointing at it will be deleted as well.
>
> But my problem is that when I delete an image (wich extends Media), the 
> GenericMedia pointing to it is not deleted.
>
> If anyone has a solution, 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/3b5f0c65-bd17-410c-8813-5ef721b321d6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django GenericRelation not working

2014-01-02 Thread arthur . muchir
I have the following model in my app, using the content-type django 
framework in version 1.6.1 :

class GenericMedia(models.Model):
limit   = models.Q(model = 'Image') | models.Q(model = 'Video') | 
models.Q(model = 'Other')
content_type= models.ForeignKey(ContentType, limit_choices_to = limit)
object_id   = models.PositiveIntegerField()
content_object  = generic.GenericForeignKey('content_type', 'object_id')

def __unicode__(self):
return u"%s" % os.path.basename(self.content_object.url.name)

def instance(self):
return self.content_object.__class__.__name__

class Media(models.Model):
description = models.CharField(blank = True, max_length = 500)
link= models.URLField(blank = True)
genericFK   = generic.GenericRelation(GenericMedia, 
content_type_field='content_type', object_id_field='object_id')

class Meta:
abstract = True

def __unicode__(self):
return u"%s" % os.path.basename(self.url.name)

def save(self, *args, **kwargs):
super(Media, self).save(*args, **kwargs)
generic_link = GenericMedia(content_object = self)
generic_link.save()

class Image(Media):
imgW = models.PositiveSmallIntegerField()
imgH = models.PositiveSmallIntegerField()
url  = models.ImageField(upload_to = 'mediamanager', height_field = 'imgH', 
width_field = 'imgW')

Everythings works fine, excepts the GenericRelation in my abstract Media Class.

In django documentation it is said that :
If you delete an object that has a GenericRelation, any objects which have a 
GenericForeignKey pointing at it will be deleted as well.

But my problem is that when I delete an image (wich extends Media), the 
GenericMedia pointing to it is not deleted.

If anyone has a solution, 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/9a090654-0298-4cfd-a71b-c815cca53ee0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query friends of an user

2013-12-17 Thread Arthur Silva
Thanks for your reply.
Your suggestion works but I need the friends (User models) of a given user
(User model) in this case.
This join (friends of an user) is also used at several other places to get
stuff (comments for example) made by friends of an user.

--
Arthur Pires Ribeiro Silva
Universidade Federal de Uberlândia
(34) 9187-4731


On Tue, Dec 17, 2013 at 2:51 PM, C. Kirby <mist...@gmail.com> wrote:

> Why not just Friendship.objects.filter(user__pk = 32, status__in =
> [Friendship.FRIEND, Friendship.FAVORITE]) That will give you a QuerySet of
> all the friendships a user has. If you just want the list of friends then
> extend that query with a values_list like so:
>
> Friendship.objects.filter(user__pk = 32, status__in = [Friendship.FRIEND,
> Friendship.FAVORITE]) .values_list('friend', flat=True)
>
>
>
> On Tuesday, December 17, 2013 8:50:09 AM UTC-6, Arthur Silva wrote:
>>
>>  I want to query the friends of an User but I'm struggling to get the
>> correct query.
>>
>> Models:
>>
>> class User(AbstractUser, TimestampedModel, SerializeMixin):
>> city = models.CharField(max_length=60, blank=True)
>> picture = models.URLField(blank=True)
>> cover_picture = models.URLField(blank=True)
>> phone = models.CharField(max_length=20, blank=True)
>> access_token = models.CharField(max_length=32, blank=True,
>> null=True, db_index=True)
>> facebook_token = models.CharField(max_length=1024, blank=True,
>> null=True)
>> facebook_id = models.BigIntegerField(blank=True, null=True,
>> db_index=True)
>> twitter_token = models.CharField(max_length=1024, blank=True,
>> null=True)
>> twitter_id = models.BigIntegerField(blank=True, null=True,
>> unique=True)
>> friends = models.ManyToManyField("self", through="Friendship",
>> symmetrical=False)
>>
>>
>> class Friendship(TimestampedModel, SerializeMixin):
>> PENDING = "pending"
>> FRIEND = "friend"
>> FAVORITE = "favorite"
>> STATUS_CHOICES = (
>> (PENDING, "Pending"),
>> (FRIEND, "Friend"),
>> (FAVORITE, "Favorite")
>> )
>> user = models.ForeignKey(User, related_name="friendships")
>> friend = models.ForeignKey(User, related_name="friendships_reverse")
>> status = models.CharField(max_length=20, default=PENDING,
>> choices=STATUS_CHOICES)
>>
>>
>> Query I'm trying to make
>>
>> id = 32 # I want friends from this user
>> friends = User.objects.extra(select={"friendship_status":
>> "status"}). \
>> filter(Q(friendships_reverse__user_id=id),
>> ~Q(friendships_reverse__status=Friendship.PENDING))
>>
>>
>> But the generated query is quite weird:
>>
>> SELECT (status) AS `friendship_status`,
>>`myapp_user`.`id`,
>>`myapp_user`.`password`,
>>`myapp_user`.`last_login`,
>>`myapp_user`.`is_superuser`,
>>`myapp_user`.`username`,
>>`myapp_user`.`first_name`,
>>`myapp_user`.`last_name`,
>>`myapp_user`.`email`,
>>`myapp_user`.`is_staff`,
>>`myapp_user`.`is_active`,
>>`myapp_user`.`date_joined`,
>>`myapp_user`.`created_at`,
>>`myapp_user`.`updated_at`,
>>`myapp_user`.`city`,
>>`myapp_user`.`picture`,
>>`myapp_user`.`cover_picture`,
>>`myapp_user`.`phone`,
>>`myapp_user`.`access_token`,
>>`myapp_user`.`facebook_token`,
>>`myapp_user`.`facebook_id`,
>>`myapp_user`.`twitter_token`,
>>`myapp_user`.`twitter_id`
>> FROM `myapp_user`
>> INNER JOIN `myapp_friendship` ON (`myapp_user`.`id` =
>> `myapp_friendship`.`friend_id`)
>> WHERE (`myapp_friendship`.`user_id` = 32
>>AND NOT ((`myapp_user`.`id` IN
>>(SELECT U1.`friend_id`
>> FROM `myapp_friendship` U1
>> WHERE (U1.`status` = 'pending'
>>AND U1.`friend_id` IS NOT NULL))
>>  AND `myapp_user`.`id` IS NOT NULL)))
>>
>>
>> Where clause should be as simple as:
>> `myapp_friendship`.`user_id` = 32 AND `myapp_friendship` != 'pending'
>>
>> Can someone shed some light? This kind of issue is appearing all over my
>> application.
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django 

Query friends of an user

2013-12-17 Thread Arthur Silva
 I want to query the friends of an User but I'm struggling to get the 
correct query.

Models:

class User(AbstractUser, TimestampedModel, SerializeMixin):
city = models.CharField(max_length=60, blank=True)
picture = models.URLField(blank=True)
cover_picture = models.URLField(blank=True)
phone = models.CharField(max_length=20, blank=True)
access_token = models.CharField(max_length=32, blank=True, null=True, 
db_index=True)
facebook_token = models.CharField(max_length=1024, blank=True, 
null=True)
facebook_id = models.BigIntegerField(blank=True, null=True, 
db_index=True)
twitter_token = models.CharField(max_length=1024, blank=True, null=True)
twitter_id = models.BigIntegerField(blank=True, null=True, unique=True)
friends = models.ManyToManyField("self", through="Friendship", 
symmetrical=False)


class Friendship(TimestampedModel, SerializeMixin):
PENDING = "pending"
FRIEND = "friend"
FAVORITE = "favorite"
STATUS_CHOICES = (
(PENDING, "Pending"),
(FRIEND, "Friend"),
(FAVORITE, "Favorite")
)
user = models.ForeignKey(User, related_name="friendships")
friend = models.ForeignKey(User, related_name="friendships_reverse")
status = models.CharField(max_length=20, default=PENDING, 
choices=STATUS_CHOICES)


Query I'm trying to make

id = 32 # I want friends from this user
friends = User.objects.extra(select={"friendship_status": 
"status"}). \
filter(Q(friendships_reverse__user_id=id), 
~Q(friendships_reverse__status=Friendship.PENDING))


But the generated query is quite weird:

SELECT (status) AS `friendship_status`,
   `myapp_user`.`id`,
   `myapp_user`.`password`,
   `myapp_user`.`last_login`,
   `myapp_user`.`is_superuser`,
   `myapp_user`.`username`,
   `myapp_user`.`first_name`,
   `myapp_user`.`last_name`,
   `myapp_user`.`email`,
   `myapp_user`.`is_staff`,
   `myapp_user`.`is_active`,
   `myapp_user`.`date_joined`,
   `myapp_user`.`created_at`,
   `myapp_user`.`updated_at`,
   `myapp_user`.`city`,
   `myapp_user`.`picture`,
   `myapp_user`.`cover_picture`,
   `myapp_user`.`phone`,
   `myapp_user`.`access_token`,
   `myapp_user`.`facebook_token`,
   `myapp_user`.`facebook_id`,
   `myapp_user`.`twitter_token`,
   `myapp_user`.`twitter_id`
FROM `myapp_user`
INNER JOIN `myapp_friendship` ON (`myapp_user`.`id` = 
`myapp_friendship`.`friend_id`)
WHERE (`myapp_friendship`.`user_id` = 32
   AND NOT ((`myapp_user`.`id` IN
   (SELECT U1.`friend_id`
FROM `myapp_friendship` U1
WHERE (U1.`status` = 'pending'
   AND U1.`friend_id` IS NOT NULL))
 AND `myapp_user`.`id` IS NOT NULL)))


Where clause should be as simple as:
`myapp_friendship`.`user_id` = 32 AND `myapp_friendship` != 'pending' 

Can someone shed some light? This kind of issue is appearing all over my 
application.

-- 
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/9a418a08-9183-477f-a8fe-e848d200f022%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django ORM generating the wrong query for recent friends of an user

2013-10-16 Thread Arthur Silva
I still can't find the problem.  Django isn't using the same "friendship" 
joined table for both conditions which makes me wonder if it's related to 
this 
https://docs.djangoproject.com/en/1.5/topics/db/queries/#spanning-multi-valued-relationships

Please help.

On Tuesday, September 24, 2013 10:50:54 AM UTC-3, Arthur Silva wrote:
>
> Here're my models
>
>
> class PingUser(AbstractUser):
> friends = models.ManyToManyField("self", through="Friendship", 
> symmetrical=False)
> 
> class Friendship(TimestampedModel, SerializeMixin):
> STATUS_CHOICES = (
> ("pending", "Pending"),
> ("friend", "Friend"),
> ("favorite", "Favorite")
> )
> user = models.ForeignKey(PingUser, related_name="friendships")
> friend = models.ForeignKey(PingUser, 
> related_name="friendships_reverse")
> status = models.CharField(max_length=20, 
> default=STATUS_CHOICES[0][0], choices=STATUS_CHOICES)
>
> class Meta:
> unique_together = [('user', 'friend')]
>
>
>
> The code I'm using to get the most recent friends of user 4
>
>
> id = 4
> friendships = Friendship.objects.exclude(status="pending").filter(
> ~Q(user__friendships__status="pending"), 
> user__friendships__friend_id=id).order_by("-created_at")
>
>
> I also tried several combinations like grouping all filtering inside one 
> filter() but the query is the same
>
>
> Generated query
>
>
> SELECT `sample_app_friendship`.`id`,
>`sample_app_friendship`.`created_at`,
>`sample_app_friendship`.`updated_at`,
>`sample_app_friendship`.`user_id`,
>`sample_app_friendship`.`friend_id`,
>`sample_app_friendship`.`status`
> FROM `sample_app_friendship`
> INNER JOIN `sample_app_pinguser` ON (`sample_app_friendship`.`user_id` 
> = `sample_app_pinguser`.`id`)
> INNER JOIN `sample_app_friendship` T5 ON (`sample_app_pinguser`.`id` = 
> T5.`user_id`)
> WHERE (NOT (`sample_app_friendship`.`status` = 'pending')
>AND NOT ((`sample_app_friendship`.`user_id` IN
>(SELECT U2.`user_id`
> FROM `sample_app_friendship` U2
> WHERE (U2.`status` = 'pending'
>AND U2.`user_id` IS NOT NULL))
>  AND `sample_app_pinguser`.`id` IS NOT NULL))
>AND T5.`friend_id` = 4)
>
>
>
> The desired query is actually
>
>
> SELECT `sample_app_friendship`.`id`,
>`sample_app_friendship`.`created_at`,
>`sample_app_friendship`.`updated_at`,
>`sample_app_friendship`.`user_id`,
>`sample_app_friendship`.`friend_id`,
>`sample_app_friendship`.`status`
> FROM `sample_app_friendship`
> INNER JOIN `sample_app_pinguser` ON (`sample_app_friendship`.`user_id` 
> = `sample_app_pinguser`.`id`)
> INNER JOIN `sample_app_friendship` T5 ON (`sample_app_pinguser`.`id` = 
> T5.`user_id`)
> WHERE (NOT (`sample_app_friendship`.`status` = 'pending')
>AND (NOT T5.`status` = 'pending')
>AND T5.`friend_id` = 4)
>
> Someone more experienced can shed some light?
>
> 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/e38830e9-51a6-4ed2-afa9-dc2b44c8110f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django ORM generating the wrong query for recent friends of an user

2013-09-24 Thread Arthur Silva
Here're my models


class PingUser(AbstractUser):
friends = models.ManyToManyField("self", through="Friendship", 
symmetrical=False)

class Friendship(TimestampedModel, SerializeMixin):
STATUS_CHOICES = (
("pending", "Pending"),
("friend", "Friend"),
("favorite", "Favorite")
)
user = models.ForeignKey(PingUser, related_name="friendships")
friend = models.ForeignKey(PingUser, 
related_name="friendships_reverse")
status = models.CharField(max_length=20, 
default=STATUS_CHOICES[0][0], choices=STATUS_CHOICES)

class Meta:
unique_together = [('user', 'friend')]



The code I'm using to get the most recent friends of user 4


id = 4
friendships = Friendship.objects.exclude(status="pending").filter(
~Q(user__friendships__status="pending"), 
user__friendships__friend_id=id).order_by("-created_at")


I also tried several combinations like grouping all filtering inside one 
filter() but the query is the same


Generated query


SELECT `sample_app_friendship`.`id`,
   `sample_app_friendship`.`created_at`,
   `sample_app_friendship`.`updated_at`,
   `sample_app_friendship`.`user_id`,
   `sample_app_friendship`.`friend_id`,
   `sample_app_friendship`.`status`
FROM `sample_app_friendship`
INNER JOIN `sample_app_pinguser` ON (`sample_app_friendship`.`user_id` 
= `sample_app_pinguser`.`id`)
INNER JOIN `sample_app_friendship` T5 ON (`sample_app_pinguser`.`id` = 
T5.`user_id`)
WHERE (NOT (`sample_app_friendship`.`status` = 'pending')
   AND NOT ((`sample_app_friendship`.`user_id` IN
   (SELECT U2.`user_id`
FROM `sample_app_friendship` U2
WHERE (U2.`status` = 'pending'
   AND U2.`user_id` IS NOT NULL))
 AND `sample_app_pinguser`.`id` IS NOT NULL))
   AND T5.`friend_id` = 4)



The desired query is actually


SELECT `sample_app_friendship`.`id`,
   `sample_app_friendship`.`created_at`,
   `sample_app_friendship`.`updated_at`,
   `sample_app_friendship`.`user_id`,
   `sample_app_friendship`.`friend_id`,
   `sample_app_friendship`.`status`
FROM `sample_app_friendship`
INNER JOIN `sample_app_pinguser` ON (`sample_app_friendship`.`user_id` 
= `sample_app_pinguser`.`id`)
INNER JOIN `sample_app_friendship` T5 ON (`sample_app_pinguser`.`id` = 
T5.`user_id`)
WHERE (NOT (`sample_app_friendship`.`status` = 'pending')
   AND (NOT T5.`status` = 'pending')
   AND T5.`friend_id` = 4)

Someone more experienced can shed some light?

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.


Time zone support enabled in Django 1.4, yet "Django does not support timezone-aware times"

2012-05-21 Thread Arthur
Hello,

I recently upgraded one of my machines to Django 1.4 to patch a bug related 
to the use of PostGIS 9.1. I read the documentation on the new support for 
time zones and added USE_TZ=True to my settings.py file. Nonetheless, when 
I attempt to load data into my PostGIS database in one of the following 
ways, I receive a ValueError: Django does not support timezone-aware times. 
The full traceback is posted at the end.

In the clean() method of my model:
self.datetime = datetime.datetime.combine(self.date, 
self.time).replace(tzinfo=UTC())

Or in the handle() method of a Command instance:
data_dict['datetime'] = datetime.datetime.combine(data_dict['date'], 
data_dict['time']).replace(tzinfo=UTC())

Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File 
"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
line 458, in execute_manager
utility.execute()
  File 
"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
line 381, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
line 219, in run_from_argv
self.execute(*args, **options.__dict__)
  File 
"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
line 256, in execute
output = self.handle(*args, **options)
  File 
"/usr/local/dev/gass/../gass/bering/management/commands/load_station_data.py", 
line 108, in handle
data_obj.save() # Save the record to the database only if it doesn't 
already exist
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", 
line 483, in save
force_update=force_update, update_fields=update_fields)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", 
line 578, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, 
using=using, raw=raw)
  File 
"/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 
203, in _insert
return insert_query(self.model, objs, fields, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", 
line 1581, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
  File 
"/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", 
line 906, in execute_sql
for sql, params in self.as_sql():
  File 
"/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", 
line 869, in as_sql
for obj in self.query.objs
  File 
"/usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py", 
line 296, in get_db_prep_save
prepared=False)
  File 
"/usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py", 
line 1258, in get_db_prep_value
return connection.ops.value_to_db_time(value)
  File 
"/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", 
line 809, in value_to_db_time
raise ValueError("Django does not support timezone-aware times.")
ValueError: Django does not support timezone-aware times.

Any advice is appreciated. 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/-/P37vjM6CWZAJ.
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.



Formwizard and manytomany

2011-11-25 Thread Arthur Fortes
Hello, I'm new in Django and I got a problem with a formwizard. My
manytomany dont works with formwizard. When I try appears this
error :
'areaes' is an invalid keyword argument for this function. What I
should do?


models.py
>areaes = models.ManyToManyField(areavaga,verbose_name='Area da vaga*') >
> pret_salario = models.CharField('Pretenção 
> salarial*',max_length=2,choices=SALARIO_C)
> cargointeresse = models.CharField('Cargo de interesse*',max_length =20)
> tipoperfil = models.CharField('Tipo de 
> perfil*',max_length=2,choices=TIPOPERFIL_C)

forms.py
> class usuarioForm(forms.ModelForm):
>class Meta:
> model = usuario
> areaes = forms.ModelMultipleChoiceField(queryset=areavaga.objects.all())
> pret_salario = 
> forms.ChoiceField(widget=forms.Select(attrs={'class':'validate[required] 
> select-medium'}), choices=SALARIO_C)
> cargointeresse = forms.CharField(max_length =50, 
> widget=forms.TextInput(attrs={'class':'input-medium validate[required]'}))
> tipoperfil = 
> forms.ChoiceField(widget=RadioSelect(renderer=HorizRadioRenderer, 
> attrs={'class':'validate[required]'}), >choices=TIPOPERFIL_C)

formwizard
> class CadastroWizard(FormWizard):
> def get_template(self, step):
> return ['forms/wizard_%s.html' % step]
> def done(self, request, form_list):
> data = {}
> for form in form_list:
> data.update(form.cleaned_data)
> user = User(
> username=data['email'],
> first_name=data['nome'],
> email=data['email']
> )
> user.set_password(data['senha'])
> user.save()
> tipo = usuario.objects.create(**data) <<<--- In here!
> return render_to_response('cadastro-concluido.html', {'data':
> data}, context_instance=RequestContext(request))



Thanks for attention.

-- 
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: Python Weekly

2011-09-26 Thread Arthur Gouveia
Nice one. I'm in.

--
Arthur Gouveia
Web Developer

http://arthurgouveia.com



On Mon, Sep 26, 2011 at 1:46 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Sample looks quite interesting - subscribed.
>
>
> On Mon, Sep 26, 2011 at 6:43 PM, Rahul <rahul_g_chaudh...@yahoo.com>wrote:
>
>> Hi Everyone,
>>
>> I have started a free weekly newsletter called Python Weekly which
>> includes curated news, articles, new releases, software & tools,
>> events, jobs etc about Python and related technologies. It's a great
>> way to keep abreast of what's happening in Python land. You can
>> subscribe to it here, http://www.pythonweekly.com/
>>
>> Regards
>> Rahul Chaudhary
>>
>> --
>> 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.
>

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



Following "first app" tutorial -- admin site can't find css files

2009-12-06 Thread Arthur
I'm using svn install.  I am using the same virtualhost for django and
static files, with ADMIN_MEDIA_PREFIX set to '/media/', which I
believe was the default.

The admin app works fine so far, but the server gives me a 404 on the
css files:

  Using the URLconf defined in testproject.urls,
  Django tried these URL patterns, in this order:
  ^admin/
  The current URL, media/css/base.css, didn't match any of these.

Can anyone help me with this problem?  I really don't understand how
the ADMIN_MEDIA_PREFIX interacts with the urlconf settings.

Thank you,
Arthur


--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Using variables as keywords in QuerySet

2009-10-21 Thread Arthur Metasov

2009/10/21 valler <180...@gmail.com>:
>
> Hello. I want to know, if something like that possible:
>  MyModel.objects.filter(name__contains='foo',status__exact='bar') =>
> It's OK.
>
> But I want to use dynamic keyword generation, like that:
>  a='name'
>  b='status'
>  MyModel.objects.filter(a__contains='foo',b__exact='bar')
>
> Is it possible somehow?

a='name'
b='status'
keyword_arguments = {}
keyword_arguments[a+'__contains']='foo';
keyword_arguments[b+'__exact']='bar';
MyModel.objects.filter(**keyword_arguments)

--~--~-~--~~~---~--~~
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: Apply decorator to view functions in third-party apps?

2009-10-13 Thread Arthur Metasov

2009/10/13, Nan :
>
> Making request global definitely sounds like a potentially fragile
> solution.  I noticed that the template loaders take a directory list
> argument, but it doesn't seem to ever get passed in -- it's not even
> an argument for loader.get_template() or loader.select_template().
>
> One possibility might be to replace render_to_response, but I'm still
> stuck on how to pass the request or theme variable to it; plus there
> are some apps that don't use render_to_response.
>
> I'm starting to think that I'll need to branch Django itself to make
> this possible, which seems ridiculous.

Even if you patch django and add request argument to get_template you
also should rewrite all aplication views to push their requests into
get_template.

It's quite simple to only patch views in applications and make them
working with your themes.

--~--~-~--~~~---~--~~
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: authorization

2009-10-13 Thread Arthur Metasov
2009/10/13 elminio 

>
> Hi,
>
> By admin I can choose what users can do with model objects. And what
> about certain pages. Do I have to write if in everyone view method (to
> check is current user may access given view ?
>
> Or is there any built in tool that makes it possible to restrict
> access to given pages.
>
> thanks for help
>

from django.contrib.auth.decorators import permission_required

@permission_required('can_edit_models', login_url='/go_away_from_here/')
def view(request):
...

--~--~-~--~~~---~--~~
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: Uploading an Image.

2009-10-13 Thread Arthur Metasov
2009/10/13 Chirolo <wist...@gmail.com>

>
> Hi Arthur.
> I'm not so experience with linux.
> I can get to the directories and files of apparmor, but how do I
> stopped.
> Thank you.
>
Something like this

> u...@host$ sudo /etc/init.d/apparmor stop
>  * Unloading AppArmor profiles   [
OK ]
> u...@host$

--~--~-~--~~~---~--~~
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: Apply decorator to view functions in third-party apps?

2009-10-13 Thread Arthur Metasov
Ok, moving this code to decoration function really good.
And now do you want to add this template selection logic into third-party
apps you using in this project?

I have no idea.

As i remember this is called monkey-patching

>>> import test
>>> def heh(func):
...  def helper():
...   print "y"
...   func()
...  return helper
...
>>> test.a()
x
>>> test.a = heh(test.a)
>>> test.a()
y
x
>>>

you can remotely replace functions in any views.py with your own. For
example

from third_party_app import views as third_party_views
for attr_name in dir(third_party_views):
view = getattr(third_party_views, attr_name)
if callable(view):
setattr(third_party_views, attr_name, decorator(view))

BUT! Third-party app is using django's get_template and select_template
functions to retrieve a template.
There we have function call with hard-coded template name. And we cannot
change it. We can monkey-patch function in the module but it also will have
no information about HttpRequest...

All I can see here is trying to decorate view with decorator setting global
variable in that views module to current request. Then decorating function
get_template to pick this global variable, use it and hope django is
non-threaded =)

2009/10/13 Nan <ringe...@gmail.com>

>
>
> Well, I'm using a theming system -- each user can choose a theme to
> use, and that choice is attached to their account.  Not just the base
> template but the inner templates for some parts of the site can vary
> from theme to theme, so I want to run something to the following
> effect:
>
> def my_r2r(request, template, context):
>  # template is a path like 'app/foo.html'
>  theme = request.user.get_profile().theme
>  theme_template = theme.adjust_theme_path(template)
>  t = loader.select_template((template, theme_template))
>  return HttpResponse(t.render(RequestContext(request, context)))
>
> A custom template loader would be a really neat solution, but I can't
> see any way to pass it the request in order for it to select the
> template.
>
>
>
>
> On Oct 12, 3:17 pm, Arthur Metasov <meta...@gmail.com> wrote:
> > You should carefully look at the code of django template loaders.
> > What do you mean? Dou you want template paths to be stored in the
> database
> > and dinamically change? Or do you want to use 3rd-party app but change
> > template dirs it is looking for?
> >
> > 2009/10/12 ringemup <ringe...@gmail.com>
> >
> >
> >
> > > I need to find a way to programmatically change the template path for
> > > every view in my project -- a decorator seems like a nice DRY way to
> > > accomplish that.  But what's the best way to apply it to views in
> > > third-party apps?
> >
> > > The only way to accomplish this that I can think of is to declare new
> > > decorated versions of the view functions in my own views.py and
> > > duplicate the urlpatterns into my own urlconf rather than including
> > > the apps' url patterns.  The new patterns will call the decorated
> > > functions.
> >
> > > Is there a cleaner or simpler way to do this?
> >
>

--~--~-~--~~~---~--~~
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: how to get back to a view requiring login

2009-10-12 Thread Arthur Metasov
as for me, @login_required decorator redirects to
http://localhost/accounts/login/?next=/path/
if you use generic view to display login page it will automatically redirect
user to /path/ after login.

2009/10/12 Sergio A. 

>
> I've three views each with different URL. They are visible to logged
> in users.
> If a non-logged user tries to access a URL requiring login, I'm able
> to redirect it to the login page.
>
> What I'm missing is how to go back to the initial page, once the user
> log in the system.
>
>
> Cheers, Sergio
> >
>

--~--~-~--~~~---~--~~
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: __unicode__(self) doesn't work

2009-10-12 Thread Arthur Metasov
2009/10/12 Denis Bahati 

> Hi there i have the problem with unicode function it doesn't give me any
> changes. the poll list is displayed as Poll object and does doesn't give me
> error if i write the models.py like this:from django.db import models
> import datetime
>
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> def __unicode__(self):
>  return self.question
> def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
> def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
> was_published_today.short_description = 'Published today?'
>
> this identation makes functions live in module, not class. You should add
one ident to your methods to push them into class body like this:
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
 return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()

--~--~-~--~~~---~--~~
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: Apply decorator to view functions in third-party apps?

2009-10-12 Thread Arthur Metasov
You should carefully look at the code of django template loaders.
What do you mean? Dou you want template paths to be stored in the database
and dinamically change? Or do you want to use 3rd-party app but change
template dirs it is looking for?

2009/10/12 ringemup 

>
> I need to find a way to programmatically change the template path for
> every view in my project -- a decorator seems like a nice DRY way to
> accomplish that.  But what's the best way to apply it to views in
> third-party apps?
>
> The only way to accomplish this that I can think of is to declare new
> decorated versions of the view functions in my own views.py and
> duplicate the urlpatterns into my own urlconf rather than including
> the apps' url patterns.  The new patterns will call the decorated
> functions.
>
> Is there a cleaner or simpler way to do this?
> >
>

--~--~-~--~~~---~--~~
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: sorl thumbnail error

2009-10-11 Thread Arthur Metasov
2009/10/12 Malcolm MacKinnon 

> Hi,
> I'm getting error messages with sorl thumbnail. I'm simply trying to show
> thumbnail images on my template. I select a number of images in my views,
> and iterate over my selection. Note that all my images are a certain size,
> and I'm just trying to reduce that size in my template using sorl thumbnail.
> All works fine, until I use the following template thumbnail tag:
>
> 
>
> where {{ob}} is the source directory of my image. I get the following
> error:
>
> ThumbnailException: Source file: '/home/malcolm/data1/orders1/media/{{obj}}' 
> does not exist.
>
>
> Removing quotes like this
> 
>
> gives me this :
> Could not parse the remainder: '{{obj}}' from '{{obj}}'
>
>
> heh... "{% thumbnail obj 80x80 %}"

--~--~-~--~~~---~--~~
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: Uploading an Image.

2009-10-11 Thread Arthur Metasov
If you use distribution with apparmor try to stop it (/etc/init.d/apparmor).

If the problem disappears, find apparmor config for apache and add there

/home/Djangoprojects/ rw,
/home/Djangoprojects/** rw,
/home/Djangoprojects/imageupload/** rw,

2009/10/11 Chirolo 

>
> Hi Bayuadji.
> I already change the permissions for my Djangoprojects directory to
> rwxrwxrwx, but still couldn't write to my Image directory, which I
> also changed the permissions.
> Do I need to change the permissions to my /home directory?
> Here are the permissions of my home directory -> dwrxr-xr-x
>
> On Oct 9, 7:31 pm, Bayuadji  wrote:
> > Hi Chirolo
> >
> > On 10/9/09, Chirolo  wrote:
> >
> >
> >
> > > My question is which file or directory controls this webserverprocess?
> > > or what can I do to solve my problem.
> > > Thank you in advance.
> > > Here is the error output that I get:
> > > File "/usr/lib/python2.5/os.py" in makedirs
> > >   164. makedirs(head, mode)
> > > File "/usr/lib/python2.5/os.py" in makedirs
> > >   164. makedirs(head, mode)
> > > File "/usr/lib/python2.5/os.py" in makedirs
> > >   164. makedirs(head, mode)
> > > File "/usr/lib/python2.5/os.py" in makedirs
> > >   171. mkdir(name, mode)
> >
> > > Exception Type: OSError at /imageupload/
> > > Exception Value: [Errno 13] Permission denied: '/home/Djangoprojects'
> >
> > I think the error comes when creating a directory though.
> > have you change the permission for '/home/Djangoprojects'?
> >
> > -djibon-
> >
> > --
> > --
> http://www.tumbletooth.org
> > my linkedin profile :http://www.linkedin.com/in/bayuadji
> > --
> >
>

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



Free Magazines

2007-10-02 Thread Arthur

One Year Free Magazine Subscription, please visit 
http://www.afmagazines.blogspot.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unicode question

2007-08-20 Thread arthur debert

Hi Rob.

After the unicode branch merge django expects and produces unicodes
objects throughout.

A detail how to port guide is here:
http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist

In this specific case, you can call "lower" directly on your unicode
object:
"cur_month.lower()" instead of "str.lower(cur_month)"

Cheers
Arthur



--~--~-~--~~~---~--~~
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: Using Django to generate Flash/Flex content

2007-08-15 Thread arthur debert

I'll second Patrick's opinion.

It's an interesting idea, but I doubt it will be practical at all to
put together classes at the backend and make that into an application
somehow. You're probably better off developing modules, precompiled
swf with functionality and a shell loading what modules you will have
on a given app. That information , plus data for these modules can
easily be generated from django as xml, json even amf.

I do think, however of two, kind of far fetched cases for dynamic
compiling:
a) Generating flex swfs by a gui editor at the browser, effectivily
recreating some of FlexBuilder's functionality. You could develop a
Drag and Drop GUI editor that uses django to output the mxml an have
that fed to the compiler to generate a swf file.
b) Having assets embedded into a swf, to make it easier to deal with
preloading and reduce latency for a large number of small files

Regarding swf dynamic generation the Mtasc compiler that Patrick
mentioned is great. Also for AS2 there's swf mill that could create a
library of swf files from an xml.
Also, Adobe has an Apache module for the compiler:
http://labs.adobe.com/wiki/index.php/Flex_Module_for_Apache_and_IIS

I have no idea how stable or buggy that is, but it might be
interesting.

Cheers
Arthur

On Aug 15, 8:00 am, Patrick Lauber <[EMAIL PROTECTED]> wrote:
> I work as a Flash Developer and Django Programmer.
>
> You don't and you shouldn't compile flash on a request basis.
> You should make your flash app smart enough that you can give it some
> parameters or let it talk with the backend with something like django-
> amf.
> Then it can load images, mp3 etc. or display something. With flex you
> can do some nice data bindings with django-amf.
>
> Just for reference there is a command-line compiler for AS2 too:
> called mtasc and is used by the very nice eclipse plugin "fdt" by
> powerflasher.de
>
> cheers
>
> On 15.08.2007, at 08:56, SamFeltus wrote:
>
>
>
>
>
> > I was thinking of A - D, for Django serving information for Flash
> > also.
>
> > But mainly I was thinking of...
>
> > E. Compiling Flash content ahead of time with a Python web framework.
> > Basically, creating a browser based environment to create content
> > (supplementing, not replacing the Flash/Flex/etc tools).  The tool has
> > a library of ActionScript classes, SWFs from other sources, images,
> > flvs, mp3, etc to compile into a SWF before the user requests it.
> > Basically, you create a swf in the browser, edit and recompile it in
> > the browser until it is done, then publish to the site.  Django
> > generates ActionScript instead of HTML/JS etc.  It seems to work
> > pretty easily.
>
> > F.  A live section that has a library of content, including SWF,
> > database info, images, video, audio that is designed to load a master
> > swf created in E.
>
> > As to Flash being more sophisticated, I mean HTML is only good at
> > textual information. I was thinking content that expands human
> > expression beyond the HTML web, overlays and augments it, not replaces
> > it.  It seems to me we are at the beginning of an explosion of non
> > text content on the web.
>
> > Here are some crude examples of experimental content created by
> > TurboGears and Django in the browser (with GIMP, Photoshop, MXMLC and
> > a text editor).  The code has issues of course, I am a gardener
> > Googling Python and ActionScript 3 as I go along.  :)
>
> >http://samfeltus.com/site_index.html
>
> > PS  I appreciate everyone's input.
>
> Divio GmbH
> Patrick Lauber
> Rich Media Architect
> Bachstrasse 15
> CH-8038 Zürich
>
> Fon +41 44 480 12 40
> Fax +41 44 480 12 71
> Mobile  +41 76 390 22 23
>
> Mail[EMAIL PROTECTED]
> Webhttp://www.divio.ch


--~--~-~--~~~---~--~~
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: Using Django to generate Flash/Flex content

2007-08-14 Thread arthur debert

Hi Sam.

As someone who codes Actionscript for a living, I can understand where
you are coming from.
>
> That is the point, when HTML is the lowest common denominator, a web
> application is limited.  HTML is evolving at a snail's pace, whereas
> Flash has steadily evolved into something far more sophisticated than
> HTML.  HTML has it's place, of course.
Depends of what you mean by "more sophisticated".
Flash content can't be indexed by search engines for example. How many
websites do you think can afford to be excluded from search engines?
Flash content requires more processing, besides a proprietary plugin.
This means that for example, people on a 64 bit linux can't read flash
content. iPhone can't either. As the number of people accessing the
web through different devices grow this will be more and more of an
issue . (don't even get me started on flash lite)
Flash content can't be cut and paste normally (browser menus or
browser shortcuts).
Flash content, out of the box, will break the browser's back button.
Flash content, out of the box, will not allow deep linking.

If you take these into consideration you'll see that one of this
issues excludes flash from a lot of projects. When you add them up,
you realize that very, very few sites can rely heavily on flash at
all.

Flash is great for "entertainment sites", or "advertainment". Site
where the wow factor is more important than actual content. Otherwise
flash is great as small pieces: a video player (youtube), a photo
slideshow (flickr)... etc.
Relying in flash to deliver "hard" content (text, navigation... etc)
immediately excluded your content from a lot of technologies and a lot
of users.

>
> But Flash now has a free command line compiler, so it is easy to
> manufacture SWF's from scratch in a Python program.
A " free command line compiler" means free as in beer, it still is
proprietary. If adobe decides to change it's mind on the next release,
or change licensing, it can. The mxmcl compiler, for example, loads
the jvm every-time. This means that if you wish to compile swf files
dynamically you'll be dealing with a couple of seconds of wait, plus a
large memory overhead for each request.

Also, note that your post is too vague. Django "generating flash
content" can mean, among other things:
a) django generates dynamic data, such as the description for a
slideshow. this can be done in xml or JSON, which django has excellent
support for, and it's very straight forward to extend for you specific
use (I've done quite a few of those)
b) django serializing data with AMF. For this check:
http://djangoamf.sourceforge.jp/index.php?DjangoAMF_en
and
http://cheeseshop.python.org/pypi/flashticle
c) django acting as Flash Comm. This involves reverse engeniering
protocols, flv compression and more. (I'd love to use one of these
though, specially live video enconding)
d) django acting as a xml socket server, such as unit (from moock)

The point is, flash has a lot of limitations. Papervision is cool, but
it's not meant at all to replace html. Their weblog for example is
html , and so is the mailing list.
Before people realize javascript could make web apps much more
dynamic, flash seemed like the only option for making apps more
responsive. Today, ajax has killed a lot of reasons to use flash (page
reloading, progress indicator etc). Besides for specific use of rich
media (again video, audio.. etc) and visual effects (papervision and
genereal BitmapData voodo) there's no reason to use flash, and most
hackers doing dynamic websites don't need those things at all.

Also notice than having django acting as a magic backend solution for
issues b), c) and d) is kind of moot. The largest, by far , effort
would be to reverse engineer  and implement protocols, codecs and file
formats . Once that was accomplished, having django views hook those
up would be trivial.

I've done a few all flash websites with django in the back end. I'm
pretty happy using JSON to send data in and out (I hope to  try amf
soon). I did wish there was something like Flash Communication Server
open source and written in python but I am not holding my breath for
it. If you think most data send to flash can easily be xml, JSON on
html (variables to the embed tag) django is well suited for feeding
flash content.

Cheers
Arthur


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



newforms: bound forms and prefix parameters

2007-07-14 Thread arthur debert

Hi Folks,

While implementing a form with edit inline like functionality, I've
hit a wall. In order to tell apart each inline model, I am using the
"prefix" parameter to instantiate the form. It works, but if it's a
bound form (whether from instance or getting values from a dict), if I
pass it a prefix, the rendered form shows empty values. This is easy
to test:

def test_prefix(request):
 f = forms.form_for_instance(request.user)(prefix="user_1")
 return render_to_response("test.html", {"f":f})

but if I omit the prefix such as in
f = forms.form_for_instance(request.user)()
the form renders correctly. (the html inputs show the right value)

Is there a catch here? I am sure this works, since the newforms-admin
must be using prefix to avoid name clashes when retrieving data from
the form.

Thanks,
Arthur


--~--~-~--~~~---~--~~
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: newforms: clean way to customize a widget's label?

2007-07-12 Thread arthur debert

Hi Leif.

Thanks for the pointer.
This certainly looks userful, but if I understand this right it makes
easier to link to external js and css, not customize the output of the
 tag.

Cheers
Arthur

On Jul 9, 10:06 pm, leifbyron <[EMAIL PROTECTED]> wrote:
> Arthur,
>
> You'll probably find this of interest:
>
> http://groups.google.com/group/django-developers/browse_thread/thread...
>
> Cheers,
> Leif


--~--~-~--~~~---~--~~
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: Hosting for Django

2007-06-15 Thread arthur debert

Hi Christian.

I've tried a few hosting setups in the paste year with various degrees
of success too. I've never been able to get a good, stable fcgi setup
myself.

In the end I've settle of webfaction. They have a very good setup with
you own apache instance + mod_python, and it's very affordable. Great
support as well.

If you need more control, meaning root access, a VPS will probably be
your best bet.

 Also, (mt) is working on a django-container.
> But I was disappointed the minute I knew they'd be running it off lighttpd +
> fcgi. They're working closely together with the two guys who made django, so
> I wonder what they'd be telling them about "the right way".
I am curious to see what Media Temple will come up with as well.

Cheers.
Arthur



On Jun 15, 7:53 am, Christian M Hoeppner <[EMAIL PROTECTED]> wrote:
> Hi there!
>
> This is a message for all those that have been successful in deploying django.
> It is not that I find myself unable to get a django project to show up in a
> web browser, but I'm wondering about "best practises", "the right way", and
> all that stuff.
>
> It's been hard to find a hosting provider giving a django-capable hosting
> solution at an affordable price, and I have found myself paying for a
> dedicated just for this matter.
>
> I have started a quest to gather all relevant information about django
> deployment, since I have found many lagoons in what I have found, including
> the django book's chapter "deploying django". They're talking about server
> farms and load balancing, but not a single side note is thrown about what
> some not-so-guru-like person might be wondering about when first deploying a
> django app.
>
> I can understand that you might think that apache and postgresql matters are
> out of scope. Maybe. But I don't think so. For the sake of completeness and
> comprehensiveness, I'll be seeking and throwing together whatever I might
> find usefull for all those django-noobs out there.
>
> Anyone up to help gathering? I might need some help :-)
>
> Sincerely,
> Chris Hoeppnerwww.pixware.org


--~--~-~--~~~---~--~~
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: Can someone explain custom managers to me? (model methods vs. custom mgr. methods)

2007-06-04 Thread arthur debert

It took me a while to understand manager better a little bit too.
Managers are pretty useful when you have a specific query / queryset
that will be common case, and it's more convenient to place that query
on one place and avoid repeating yourself.

For example, suppose you have a blogging app with a entry model. That
model has a boolean fiel, "public". You want to allow only public
entries to be viewed throughout the site. Instead of filtering for
public entries in a lot of places (views, feeds, sitemaps ):
entries = Entry.objects.filter(public=True)

It's just easier, and less error prone to say something like:

class EntryManager(Manager):
def public(self):
return self.filter(public=True)

Then, through the code you can just call:
entries = Entry.objects,public()

This is a simple case, but as your query gets more complex, the better
off you are.

Another case worth looking into, is custom sql. Sometimes django' ORM
is unable to make some queries (or they will be clumsy / have poor
performance) so you need to resort to hand written sql. Having that
code sit in one place only makes it more reusable (and easier to guard
against to sql injections, for example).
Django-tagging app has some well though uses of manager:
http://django-tagging.googlecode.com/svn/trunk/tagging/managers.py

Cheers,
Arthur


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



Free Handphone Optional

2007-04-27 Thread Arthur

See www.javagames.co.nr
Cool !


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



RequiredIfOtherFieldEquals validator and FileField

2007-02-28 Thread Arthur Noel

I am trying to use RequiredIfOtherFieldEquals in the validator_list  
of a FileField and have run in to a problem: When editing an existing  
object in which the FileField is already populated and no file is  
chosen for upload validation fails as there is no field_data.

Is there any way that I can make a validator as a model method so I  
have access to the instance or is there another way around this?

Thanks for any help,
Arthur

--~--~-~--~~~---~--~~
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: Calling a view from another view in the same app?

2006-09-05 Thread arthur debert

Hi facundo.

this is an issue in python that is pretty confusing for newbies.

What's happening here is that viajes is making a forward reference to
viaje, meaning that when viajes is run viaje has not been defined yet,
so it throws an exception(methods get parsed top to bottom in modules).

The fix for this is to put the 'viajes' method after 'viaje' on your
file.

cheers
arthur


--~--~-~--~~~---~--~~
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: trouble getting make-messages.py to generate .po files

2006-09-05 Thread arthur debert

Ok, got this one figured out, posting here if someone hits the same
wall.

The pre-installed gettext on the mac is version .10 something. gettext
support for python is >.12 so you must install a newer version.

installed it from darwin ports and it worked like a charm.

cheers

arthur


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



trouble getting make-messages.py to generate .po files

2006-09-04 Thread arthur debert

Hi Folks.

I am trying to set up my first django i18n site, and when running
make-messages.py on the command line I get the following error:

'errors happened while running xgettext on __init__.py
language `Python' unknown'

any ideas?

thanks,
arthur

p.s.: I am running make-messages on my project directory
I have gettext/xgettex installed
I have no code in none of my __init__.py files : they are empty.
   I am running from svn (pre 0.96)


--~--~-~--~~~---~--~~
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: drag & drop for admin-interface

2006-08-02 Thread arthur debert

Hi Patrick.

I've been planing to implement this, but haven't found the time to. I
know code speaks louder than words... but I've done some thought over
this and would like to share my opinions.



> 1. right now, you can drag & drop table rows within the change-list.
> NOT every action is stored immediately (to the database) - instead you
> ´re having two buttons (SAVE/CANCEL) at the bottom of the page. after
> you´re finished with dragging stuff around you may click SAVE - then,
> the page reloads ...
> question: would you prefer instant saving?
live saving would be nice, but it opens up a few problems. I think
having a 'batch' save will avoid many headaches.
>
> 2. the table-column which is affected is currently named "position" -
> any other suggestions?
>
hm.. I am -1 on this one.
Ideally you would be able to specify in your model if you want it to be
draggable and with which field.

let's say you've got these models
class SlideShow(Model):
title = CharField(maxlength=60)

class Slide(Model):
slideshow = ForeignKey(SlideShow)
image = ImageField(upload_to='some_dir')
order = IntegerField()

class Admin:
draggable_by = 'order'

It would probably be cleaner  to set this in the Admin inner class.
It would make it easer to integrate legacy dbs and also avoid name
clashes.
Also this would make it explicit, which is good.

> 3. within the change-list, you´re probably having filters and other
> stuff which is not necessary for DnD-action. would you prefer a
> button "REORDER" at the top of the page (e.g. within the object-
> tools) which links to another page specifically designed for DnD-
> stuff. if so, any ideas on how to get that button for certain tables
> (because not every table needs reordering)? e.g. with extending class
> admin?
>
I'm not in favor of having another page for this. Too cumbersome. Maybe
if the model specifies it allows dragging you could on top (or bottom)
of the change-list table have a text that says "Drag rows to reorder".
Once you have a successful drop you could hide that text(with js) and
change it to your buttons "SAVE ORDER" "REVERT ORDERING"(or something
like that).
> 4. do you prefer dragging the whole table-row or do you prefer having
> a button for dragging (e.g. within the last column on the right hand
> side)?
I am +1 on the whole row.
>
> any other suggestions/feedback?

> ### after the first drag, you are not able to click the link for the
> detail-page anymore. I´m not sure if this is a bug or if it´s
> intended. either way, also not good. having that in mind, it´d
> probably be better to have a different page for reordering (see above).
>
How are you handling events? Maybe if you use event bubbling you can
check if the click came from the details link and suppress dragging in
that case?

Thanks for getting this rolling...

cheers arthur


--~--~-~--~~~---~--~~
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: Displaying thumbnails in the admin interface

2006-07-19 Thread arthur debert

You should also take a look at nesh's excellent
ImageWIthThumbnailField:

http://djangoutils.python-hosting.com/wiki/Thumbnails

cheers
arthur


--~--~-~--~~~---~--~~
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: Perspective on building a community blog in a short timeframe

2006-07-14 Thread arthur debert

Hi Joe.

Also if you don't fell like reinventing the wheel, you might want to
take a look at limodou's multi-user  blog app written in django.
It's been a while since I haven't played with it, but it's probably
worth a look. More info here:
http://groups.google.com/group/django-users/browse_frm/thread/cc39700cc7147ed9/0675e2d713071f39?q=limodou=3#0675e2d713071f39

cheers
Arthur


--~--~-~--~~~---~--~~
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: Views and 404 - render_to_response

2006-07-11 Thread arthur debert


Bob wrote:

> What would it be if I want to get my item from the database by the slug?

this depends on the moel's ttribute name (the one that's a slug).
If you can post you model's code, I can assiste further...

cheers


--~--~-~--~~~---~--~~
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: Views and 404 - render_to_response

2006-07-11 Thread arthur debert

Hi Bob.

If you're getting 404's, then it's not in import problem on your view.

>From your code this line grabbed my attention:
 p = get_object_or_404(Myclass, pk=slug)

if your are searching against the pk, this will only get any results if
the slug is the pk for your model (that will only happen if you've
overriden django's pk)

if your model has a field called 'slug' you must match it against that:
 p = get_object_or_404(Myclass, slug=slug) 

hope that helps
arthur


--~--~-~--~~~---~--~~
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: book recommendations?

2006-07-10 Thread arthur debert

also, simon willison's javascript introduction is excellent:

http://flickr.com/photos/simon/sets/72057594077197868/


--~--~-~--~~~---~--~~
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: file upload with flash 8 uploader

2006-07-07 Thread arthur debert

On macrodobe's site, there's a reference implementation of php
receiveing the flash upload. it's php, but you can have an idea of
where things are on the request:

http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts=1591.html

The flash upload capabilitie is pretty nifty... I wonder if there's any
interest of creating a FileField(flash_uplload=True) option and have it
and django as an alternative.

spako:
currently uploads are kept in memory, not streamed. that means if you
are expecting large uploads (+2MB) and are on a shared server, you
might have issues (since most of them hava a memory limit your
processes can use).

patch 2070 is suppouse to work around this, but I couldn't get it
working here.

cheers
arthur


--~--~-~--~~~---~--~~
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: ForeignKey and Admin

2006-07-06 Thread arthur debert

What you are looking for is the edit_inline option for the event field:

class EventDate(models.Model):
...
event = models.ForeignKey(Event, edit_inline=True)

more info here:
http://www.djangoproject.com/documentation/tutorial2/#adding-related-objects

[] 
arthur


--~--~-~--~~~---~--~~
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 t-shirts: your ideas wanted!

2006-06-28 Thread arthur debert

"A Django Model"
...


--~--~-~--~~~---~--~~
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: Sniffing around django

2006-06-27 Thread arthur debert

In your model, overide the save method :
def save(self):
# get number of objects
maxNumber = 5
current = MyModel.objects.all().count()
if current < maxNumber:
super(MyModel, self).save()
#you can either pass - object won't be saved, or raise an exception

cheers, 
arthur


--~--~-~--~~~---~--~~
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: Model vanishes from Admin

2006-06-24 Thread arthur debert

Hi Russel.

Thanks for the patch. I am sure this one will save newbies a few hours
of starting blankly at the screen.

cheers
Arthur


--~--~-~--~~~---~--~~
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: Model vanishes from Admin

2006-06-23 Thread arthur debert

Hi Steven.

this one got me stuck for hours (grin).
if your INSTALLED_APPS is right and your admin inner class too, you
probably have an error on an import on your model class.

fire up the shell on your server setup. can you import your model
module?


--~--~-~--~~~---~--~~
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: Can a custom field have two database columns?

2006-06-23 Thread arthur debert

HI Ian.

Thanks for the pointer.
It's an interesting approach though, if I did understand it, that
requeries the "raw" markup source's name to be hardcoded into the
middleware, right (e.g. 'description')?

If so, I am back to square one, for among all models I have quite a few
that must be parsed and their names would
vary (and again, on a next app, would have to changes names again...)

thanks, 
arthur


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



Can a custom field have two database columns?

2006-06-23 Thread arthur debert

In a current project, I've got a lot of fields that must accept markup.
Currently I am using markdown to parse the raw text. I am aware of the
useful template tags to apply markdown on the template itself, but
since reads are much more common than writes I would like to store the
markup on the database, to improve performance. My current solution is
something like

class Article(Model):
raw_text = TextField(maxlength=2000)
markup_text = TextField(maxlength=2000, editable=False)

def save(self):
self.markup_text = mardown(self.raw_text)
super(Article, self).save()

Which works, but does not feel very  DRYish, since this code is spread
all over the place .
I would like to create a MarkupField using it like:

def my_func(text):
return markdown.markdown(text)

class Article(Model):
body = MarkupField(,
converter=my_func)
# where converter would be a fucntion such as markdown or te=xtile or
rest... or any other

and the MarkupField would do the conversion before saving to the
database, on another column in the database to store the markup text.
Then when accessed from templates I could say {{article.body_markup}}
and that's it.

So I guess my question boils down to this:
- can a custom field have 2 database columns (one for raw text, and
another for the markup text)? Is this possible at all?

Any pointers will be very much appreciated.

Thanks, 
Arthur


--~--~-~--~~~---~--~~
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: Photo gallery

2006-06-23 Thread arthur debert

Hi Guillermo.

I haven't looked at those galleries but if you are going to code some
of it, take a look at nesh's ImageWithThumbnail[1] field and related
utilities. You might reduce the ammount of biolerplate code greatly.

cheers
arthur
[1] http://djangoutils.python-hosting.com/wiki/Thumbnails


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



GenericForeignKey in admin

2006-06-22 Thread arthur debert

I've been playig with GenericForeignKey and they are great.

One question though, they do not show up on the admin app.

For example on the object that should be 'tagged', I would like to edit
tags inline. Is thart possible at all?

thanks, 
arthur


--~--~-~--~~~---~--~~
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: Relations accros multiple apps

2006-06-16 Thread arthur debert

Hi Fabien.
> App User:
> class User:
> #some fields
>
> App Blog
> class Blog:
> author = models.ForeignKey(User.user)
>
> Is-it possible to do that ?

Sure. Models are regular python classes, all you must do is to import
it's module before using it.
Like:
from django.contrib.auth.models import User (now you can use the User
model on you bloggin app)
If you want to import the Blog model from another app ,you can do the
same:
form myproject.blog.models import Blog # here myproject is the name
where the blog app sits.

One caveat though. If you are importing the user model, you can be sure
that i will be on every django install and you already know the path to
it.
If you plan to "plug" you blog app into other projects, you have no way
to know where on the path it will be (for example it could be on
fabienapps.blog or myclient.blog). in this case you can find out where
the app lives :
from django.db.models.loading import get_app
blog = get_app('blog')
from blog.models import Blog

cheers
arthur
> --
> Fabien SCHWOB
> _
> Derrière chaque bogue, il y a un développeur, un homme qui s'est trompé.
> (Bon, OK, parfois ils s'y mettent à plusieurs).


--~--~-~--~~~---~--~~
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: Creating a root object for a many-to-one relationship

2006-06-10 Thread arthur debert

won't this work for you:
class Node(Model):
parent = ForeignKey('self', blank=True, null=True)
... rest of your model...

then fetch it like Node.objects.filter(parent__isnull=True)

if you are worried with the possibility of ending  up with mode that
one root node you could do either (both seem a little hackish though):
a) have a is_root field on your model (still possible to have more than
one though)
b) implement a check on the model's save such as:

def save(self):
if len(Node.objects.filter(parent__isnull=True)) >0:
#node already exists => return or raise
raise "bad, root node already exists"
super(Node, self).save()

(or maybe implement a custom manager for this?)

arthur


--~--~-~--~~~---~--~~
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: one to one relationship and file upload issue

2006-06-08 Thread arthur debert

Could this be it
http://code.djangoproject.com/ticket/572  or
http://code.djangoproject.com/ticket/1584 ?

me thinks this was fixed recently.  =>
http://code.djangoproject.com/changeset/3002
are you running an up to date svn version?

see if that helps


--~--~-~--~~~---~--~~
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: one to one relationship and file upload issue

2006-06-08 Thread arthur debert

Hi james,
regarding:
> when I upload a file (a 10+MB mp3) on my local machine, it
> takes quite a while and pegs the CPU.  Is this expected and is this
> going to be the behavior when I put it in production under fastcgi?
django keeps the whole upload in memory.
this has been discussed a few times ( [1] ,[2] ). patch 1484 ( [3] )may
help you, with one caveat: doesn't work for admin.

cheers

[1]
http://groups.google.com/group/django-developers/browse_frm/thread/6395fb49e432127e/07c65899ccb6f3f5#07c65899ccb6f3f5
[2]
http://groups.google.com/group/django-users/browse_frm/thread/3fde60de4313478a/9efce043d4e8ffa9#9efce043d4e8ffa9
[3] http://code.djangoproject.com/ticket/1484


--~--~-~--~~~---~--~~
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: Weird behaviour

2006-06-07 Thread arthur debert

Hi Elver.

This is a feature.
This behaviour depends on wheter you want yor sessions to expire and
when. More details in the docs:
http://www.djangoproject.com/documentation/sessions/#browser-length-sessions-vs-persistent-sessions

arthur


--~--~-~--~~~---~--~~
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: Save method called twice on override?

2006-06-05 Thread arthur debert

Hi Alloy.

Yes, it's a bug.
more details here:
http://code.djangoproject.com/ticket/639

basically you have to check for self.imatge != '' before doing anything
with the file.
cheers, 
arthur


--~--~-~--~~~---~--~~
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 svn over https?

2006-05-28 Thread Arthur

Hi

Vladimir Pouzanov wrote:
> Eugene Lazutkin wrote:
>> SVN checkouts behind firewalls are usually solved by talking to
>> administrators and using proper HTTP proxies.
> Any hints how to fix squid so it handle that DAV stuff correctly?

As far as I know, you would have to add

extension_methods REPORT MERGE MKACTIVITY CHECKOUT

to your squid.conf file. But I don't use squid, so check that first.

Arthur

--~--~-~--~~~---~--~~
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 app

2006-05-25 Thread arthur debert

Hi Luke,

Please do so.

Tagging is, buzzword or not, pretty useful and many people have / will
implement it on their own (I was mid way through just now).

It would be great to leverage on your code, and I think it would
benefit django users in general, as it could make more applications
pluggable / easily distributable with tagging working.

thanks,
arthur

ps: how is the GenericForeignKey going to work? will it be imported
from the tagging app's package, or will it go into trunk?


--~--~-~--~~~---~--~~
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: Problems with ForeignKey in magic-removal

2006-05-15 Thread arthur debert

Hi beewee,

__repr__ has been replaced by __str__ . this is more of a return to
python conventions than anything.

try changing your __repr__ methods to __str__ ones.

more on this here:
http://groups.google.com/group/django-users/browse_frm/thread/9f6f205e0f9cbc8e/800b8c3367f79b38?q=__str__=1#800b8c3367f79b38

cheers


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



memory error on lighttp deployment (file upload)

2006-05-12 Thread arthur debert

I have an app deployed on lighttpd, but I am getting this memory error.
My local codebase runs fine (both on the devserver and on my local
lighttpd),which leads me to think it's a server issue. I am hosted on
textdrive - we're running lighttp + fcgi.

This only happens when uploading large files (+1 MB) on the admin
interface.

This is my python stack trace:
Switch back to interactive view

Traceback (most recent call last):
File "/home/stimuli/local/django_src/django/core/handlers/base.py" in
get_response
  74. response = callback(request, *callback_args, **callback_kwargs)
File
"/home/stimuli/local/django_src/django/contrib/admin/views/decorators.py"
in _checklogin
  54. return view_func(request, *args, **kwargs)
File "/home/stimuli/local/django_src/django/views/decorators/cache.py"
in _wrapped_view_func
  40. response = view_func(request, *args, **kwargs)
File
"/home/stimuli/local/django_src/django/contrib/admin/views/main.py" in
add_stage
  253. errors = manipulator.get_validation_errors(new_data)
File "/home/stimuli/local/django_src/django/forms/__init__.py" in
get_validation_errors
  58. errors.update(field.get_validation_errors(new_data))
File "/home/stimuli/local/django_src/django/forms/__init__.py" in
get_validation_errors
  351. self.run_validator(new_data, validator)
File "/home/stimuli/local/django_src/django/forms/__init__.py" in
run_validator
  337. if self.is_required or new_data.get(self.field_name, False) or
hasattr(validator, 'always_test'):
File "/home/stimuli/local/django_src/django/utils/datastructures.py" in
get
  137. val = self[key]
File "/home/stimuli/local/django_src/django/utils/datastructures.py" in
__getitem__
  114. raise MultiValueDictKeyError, "Key %r not found in %r" % (key,
self)
File "/home/stimuli/local/django_src/django/utils/datastructures.py" in
__repr__
  104. return "" % dict.__repr__(self)

  MemoryError at /admin/site_updater/demoreel/add/

and the lighttp error log entry:
2006-05-12 16:04:17: (mod_fastcgi.c.2851) backend died, we disable it
for a 5 seconds and send the request to another backend instead:
reconnects: 0 load: 1

any input on this would be very welcome.

thanks, 
arthur


--~--~-~--~~~---~--~~
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: admin not *seeing* installed app

2006-05-12 Thread arthur debert

Hi Doulgas.

It's not db related.

Somehow my fcgi script was setting the DJANGO_SETTINGS... env variable
on the wrong path.

Thanks a lot anyways, 

arthur


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



admin not *seeing* installed app

2006-05-11 Thread arthur debert

Hi folks.

I've just ran into a small glitch when moving an app to a new server.

My application is "missing" from the admin main view.
Everything is installed correctly. I can mange.py shell  and work on my
models and my data interactively (I've moved the db as well).
the application's models do have the class Admin: (on the old server
these wore working fine).

The main admin page lists the Auth and the Site apps. I can
change/add/delete users and permissions.

On the permissions side of things, the permissions to my app show up
fine (and are set right).

If I type the url that *should* work, such as /admin/myapp/mymodel/ I
get an error page saying that mymodel was not found on app *myapp*.

It's as if the django project was *seeing* the app but not the admin.
(all my models have an inner class Admin, this was working before the
server move).

Any ideas about what could be causing this?


--~--~-~--~~~---~--~~
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: OpenID

2006-05-11 Thread arthur debert

Hi Alan.

have you tried this one ?
http://code.djangoproject.com/wiki/CookBookShortcutsOpenIDAuthentication

(it's about a month old, but I haven't used it my self)

cheers, 
arthur


--~--~-~--~~~---~--~~
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: save() called 2 times.

2006-05-05 Thread arthur debert

yes this is a known bug.

see ticket 639
http://code.djangoproject.com/ticket/639

currently I'm using an ugly work around such as

def save(self):
if self.imagefield :
#do whetever, files does exist...

also this seems to cause problems withe DateFields with auto_now...


--~--~-~--~~~---~--~~
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: syncdb

2006-05-05 Thread arthur debert

yes, syncdb is for current trunk (post magic removal).

please notice that if you're using 0.91, you can use the old
documentation from here:
http://www.djangoproject.com/documentation/0_91/

but if you're just getting started updating to the dev version is your
best bet.

cheers
arthur


--~--~-~--~~~---~--~~
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: list_filter not working properly?

2006-05-05 Thread arthur debert

yes, same thing here.

strangely enough, I have a model with a foreign key acting as a
list_fillter and it's fine.

another model (same app) list filters wont't work (foreign key or not)
.

this was working a little while ago.
still looking into it...


--~--~-~--~~~---~--~~
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: Slow initial startup on Django project

2006-04-21 Thread arthur debert

Oh My!

my bad. yes that should read..
" are not going to achieve *great* performance on DREAMHOST."

I just meant to say that dreamhost has nice price / feature ration but
it's just a little unreliable to host a *critical* site on it.

Isn't it great that you could just read through my mistake (and have no
doubs that I was talink about dreamhost...)?

cheers


--~--~-~--~~~---~--~~
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: Slow initial startup on Django project

2006-04-21 Thread arthur debert

Clint, I believe this is a fcgi thing. Dreamhost kills it after a
perdiod of inactivity, which means that the first request after a few
minutes of stillness has to load django & everything else.

Later request should respond better. There are mixed reviews on
dreamhost and django on this list, quite a few topics bring this up. It
seems to depend a little in which server you are (I am on pound, and
haven't had any issues). But at any rate you are not going to achieve
*great* performance on django. 

hope that helps, 
arthur


--~--~-~--~~~---~--~~
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: sinjan

2006-04-17 Thread arthur debert

just a quick extra on this one. The documentation on the admin site
(link at top right, must have doc utils installed for this to work) is
also available on the magic-removal branch and for newbies and people
doing the transition from trunk t's pretty useful. 

cheers
arthur


--~--~-~--~~~---~--~~
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: Ecommerce & Django

2006-04-14 Thread arthur debert

I like th idea of usign  jazz musicians' names:

"monk"!


--~--~-~--~~~---~--~~
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: Ecommerce & Django

2006-04-14 Thread arthur debert

another thing that would be nice is a "downloadable type" of product
where the order relates to a download. of course, this could get pretty
complex if you add in things like serial numbers, versions, etc...but
we can start simple.I (personally) would like this, and I guess quite a
few of the early adopetrs migh want to sell software / digital goods (I
don't know, maybe their wife are selling e-books or something)


--~--~-~--~~~---~--~~
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: Importing external modules/classes

2006-04-13 Thread arthur debert

Hi Cary.

that depends if you're using magic-removal or trunk. On the m-r branch
there are no "magic" modules, whatever is on your path can be imported
as usual.

if you're using trunk, you must import inside your models methods, or
user module_constants (
http://www.djangoproject.com/documentation/model_api/#meta-options )

see also this thread:
http://groups.google.com/group/django-users/browse_frm/thread/c3c4a1ff076ae357/a6a38c1e23f52ff6?q=imports+magic=1#a6a38c1e23f52ff6


--~--~-~--~~~---~--~~
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: Ecommerce & Django

2006-04-13 Thread arthur debert

"Setup a free python project on python-hosting.com"

+1 on this one. when getting started we better focus on the coding
right away, and python hosting's capabilities (svn + trac ) setup with
no fuss will be very helpfull (it seems).

" Any brilliant ideas?" not really...

djell, djuy , djart


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



[offtopic] question on django naming choices for models relationships

2006-04-13 Thread arthur debert

Ok. This one is more of a "philosophy" question on django naming from
someone who's learning django, webdev and databases at the same time.

If I understand right, one of django's aim at the ORM level is to
abstract the sql level, including naming. This makes a lot of sense,
and when you see :
ManyToMany
OneToOne

you can see that the name of these relationships between models is very
descriptive and non-sqlish. they describe the nature of the
relationship desregarding the underlying implementation (which feels
right).
Now, for the many-to-one relations the name chosen was
ForeignKey

why is that? Isn't ForeignKey very sqlish and little descriptive?
Doesn't it points too much on the implementation?


--~--~-~--~~~---~--~~
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: Ecommerce & Django

2006-04-13 Thread arthur debert

hi folks...
am I all for it.
I've got no experience on e-commerce but there's a few things (I guess)
I may help with... I guess this would be agreat project...

I just suppose some "liberal licensing" would be nice (such as BSD or
the like)...

cheers
arthur


--~--~-~--~~~---~--~~
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: Using _pre_delete() to stop execution

2006-04-11 Thread arthur debert

Hi Glenn.


the thing is, if there's anything in django's knowledge to avoid the
save / delete it DOES raise an error. (such as trying to delete an non
existant object or trying to save a model that does not pass
validation). my guess here is if you need anything else in you logic
that django doesn't know about (from validators and the db) you must
implement it yourself.

#
try:
amodel.delete()
except:
return HttpResponseRedirect("bad_detele_action")

or something to that effect.

maybe the so called validation aware models in m-r will do it?
http://groups.google.com/group/django-developers/browse_frm/thread/4bc65cf676c93846/5d7db0f7a5f85006?q=validation+aware=2#5d7db0f7a5f85006


--~--~-~--~~~---~--~~
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: Using _pre_delete() to stop execution

2006-04-11 Thread arthur debert

Hi Norbert,
this is not possible on trunk , if you are using magic-removal, you can
do it like this:

def delete(self):
if conditionIsMet == True:
super(ModelName, self).delete() # Call the "real" delete()
method.
else:
# Don't delete.
pass

more on this here:
http://code.djangoproject.com/wiki/RemovingTheMagic#Addedamorepowerfulwayofoverridingmodelmethodsremovedhardcoded_pre_save_post_saveetc.

cheers
arthur


--~--~-~--~~~---~--~~
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: using django.core.mail with utf-8

2006-04-09 Thread arthur debert

right now this is not possible.
there is, however, a patch in the ticket system #1541 (
http://code.djangoproject.com/ticket/1541 ) that will do it... ) sample
usage on the ticket... 
cheers


--~--~-~--~~~---~--~~
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: General Database question re: multi user apps

2006-04-09 Thread Arthur

> In the past I always worked with flatfiles so every user had their own
> folder on the filesystem and all of their data was within that folder.
> Does this mean that every user should have their own table to hold
> their blog posts or I should have one blog_post table and throw
> everyone's posts into that table?

A table for every user would only be advisible if the group of users
stays the same over a very long time. Adding and removing tables
belongs to the things which you normally only do once. For a multi
user blog you'd rather put the blog posts into one table and the users
in another table. The blog posts would be connected to the users via a
foreign key.

Arthur

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



mr: DateField and "global name 'date_query' is not defined" error

2006-04-05 Thread arthur debert

I stumbled upon this error message after porting a project to
magic-removal. In the admin, if I try to get the list view for
something like:

class SomeModel(models.Model):
 title = models.CharField(maxlength=200)
 date_due = models.DateField(blank= True, null=True)

class Admin:
date_hierarchy ='date_due'

I get this confusing error:
"Exception Value:   global name 'date_query' is not defined
Exception Location: magic-removal/django/db/models/query.py in
iterator, line 479"

it took me sometime to realize that you can't have 'date_hierarchy' on
a datefield that can be blank.
anyways, I though I'd post it here in case someone struggles over this
too. 

ps: on trunk I get no error.


--~--~-~--~~~---~--~~
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: Stupid newbie question about documentation

2006-04-05 Thread arthur debert

Hi Todd.

I guess what you are looking for is:
u = User.objects.get(username='namehere')

 but you could also:

1) fire the shell (cd to your project dir) then:
   python manage.py shell
   from django.contrib.auth.models import User
   dir(User) or dir(User,objetcts.all()[0])

2) on the admin site, on the top bar there's a "Documentation" link
(mut have docutils installed ) this is very usefull for newbies, I use
it all the time. As a side bonus you get to see ForeignKey and
ManyToMany methods also.

3) checkout the source itself, since you are using this sintax you're
probably using magic-removal, then you can see the python module in :
django/contrib/auth/models.py

arthur


--~--~-~--~~~---~--~~
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: ContentType in magic removal :: how to?

2006-03-30 Thread arthur debert

thanks a lot Jacob, I WAS missing the obvious.


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



ContentType in magic removal :: how to?

2006-03-30 Thread arthur debert

Hi. I am trying to get a model's content type in magic-removal.

I have a model's instance when I try :
ContentTypeManager().get_for_model(instance)
I get :
AttributeError: 'NoneType' object has no attribute 'DoesNotExist'

I got it working with:

def get_content_type(model):
opts = model._meta
app_label = opts.app_label
model_name= opts.module_name
ct = ContentType.objects.get(app_label=app_label, model= model_name)
return ct

(which works both on instances or classes, which seems right)

sorry if this is too basic. ;-( , am I missing the obvious?
wouldn't a get_content_type() static method make sense for all model
classes?


--~--~-~--~~~---~--~~
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: Overthinking urls.py?

2006-03-28 Thread Arthur

> > "correct" and just as simple, and each time I've failed.  As far as
> > I'm concerned, if someone can come up with a way to do this that's
> > stupidly simple then I'm all for a change, but at the same time
> > get_absolute_url() is a wart I'm willing to live with.
>
> In the model you want to know "what is this object's identifier that
> we would use in a url".   That might be just an object ID, a slug,
> or maybe /mm/dd/id or who knows what.  This would be formated
> such that it could be used as-is as PART of a URL.  Let's call this method
> "get_id_for_url()"  (or whatever you end up calling it)  That seems to be
> the appropriate type of data to come from a Model.. i.e. not the entire
> absolute URL, but just a portion of the URL that would be used to
> identify this Model's object.
>
> Then, in the particular view (not clear, it might be and/or in the
> template) you would want to combine some base URL string with the
> previous get_id_for_url string to make it into a real url.  To do that
> might need just a variable "base_url" (or it could be yet another view
> specific method) that changes by the view.
>
> So in a template you'd have to do
> {{ base_url }}{{ this-object.get_id_for_url }}
>
> In your urls.py and/or view you'd setup a dict to pass the appropriate
> value to the template e.g.
>info_dict = {
>'app_label': 'myapp',
>'module_name': 'mymods',
>'base_url': 'mymods',
>}
>
> That would allow me to use the generic views if I sent the 'base_url' 
> correctly,
> or you could even have it default to the 'module_name'.  Or I could code
> it into my view's code however I wish.

That's similar to what I do. The get_absolute_url() concatenates a
_BASE_URL from settings.py or from the top of models.py with
what you call get_id_for_url. This isn't completely clean but easy to
change if you remember where to look for the constant.

Arthur

--~--~-~--~~~---~--~~
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: ASCII or PDF version of docs?

2006-03-28 Thread Arthur

> > I maintain that all of the online docs need to be in the tar file...
>
> It would be nice and clean to take the code that converts the ReST
> docs into HTML, and the unit tests into HTML, and bundle that with
> Django along with a simple view that displays it, converting the docs
> on the fly -- so you can run a local Django instance to get the docs
> in HTML.

+1 on this one. The last time I've tried building the docs I've run
into some problems (some files gave errors where I wasn't sure whether
my setup was to blame) and the style information is missing. This
would hopefully also help to keep the docs more up to date as more
people would find inconsistencies when using the trunk or branches.

Arthur

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



magic removal : problem when subclassing User

2006-03-27 Thread arthur debert

I am subclassing User in magic-removal, and ran into this gotcha. My
model:

class Account(User):
tel = models.CharField(maxlength = 14, blank=True)
book = models.ManyToManyField(Book, blank=True)

in a view I when I try this:

acc = Account.objects.get(username=test_username)
print "returning type = %s " % type(acc)

it does find the right record, but returns an User instance. it prints:
returning type =  JohnDoe

>From there, if I try to use it as an Account instance (such as
"acc.tel") python raises an execption.
Can any one point me in the right direction?


--~--~-~--~~~---~--~~
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: Assigning default value for field in admin

2006-03-24 Thread arthur debert

If I read you right:
http://www.djangoproject.com/documentation/faq/#how-do-i-automatically-set-a-field-s-value-to-the-user-who-last-edited-the-object-in-the-admin

I've solved almost this problem in an app, but that's because I would
get the user from the session cookie and put it on the request for the
form to be "auto-filled". It seems there's no out of the box way to
achieve this.

-arthur


--~--~-~--~~~---~--~~
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: Extreme file uploading

2006-03-24 Thread arthur debert

Hi Andy.

Regarding memory usage on the server, AFAIK this is something related
to cgi.FieldStorage. more about this here:
http://groups.google.com/group/django-developers/browse_frm/thread/2c379ec0fa30804a/#

It would be great to have a streaming option, but aparentely this is
trickier than it seems. I guess there's quite a few people with this
kind on need hanging around this list... so maybe a solution can be
implemented.

I am not uploading anything near 200MB, but 8 MB with no progress
feeback and no resume is pretty scary for me.

Maybe at 200 MB you should try ftping it?

Off topic, has anyone seen dropsend (http://dropsend.com/)? they've
managed to get a reliable progress bar... 

cheers, arthur


--~--~-~--~~~---~--~~
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: Generic views in magic removal

2006-03-22 Thread Arthur

> I think I figured it out, your RegEx should be:
> (?P\d+)/$

Ah, much better. I've looked at the completely wrong places. I still
wonder a bit about the error message.

Now it only complains about missing templates which I should be able to fix.

Thanks so much

Arthur

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



  1   2   >