tutorial 1 sql problem

2005-09-05 Thread julo

Hi all,

I installed Django on Ubuntu Linux. I used Julian Hernandez Gomez's
steps written on http://www.djangoproject.com/documentation/install/.
"django-admin.py sql polls" produces for me the error described below.
I am complete newbie to both python and django.

Thanks,
Julo


-
[EMAIL PROTECTED]:~/django/myproject$ export
PYTHONPATH=$PYTHONPATH:$HOME/django

[EMAIL PROTECTED]:~/django/myproject$ django-admin.py sql polls
Traceback (most recent call last):
  File "/usr/bin/django-admin.py", line 116, in ?
main()
  File "/usr/bin/django-admin.py", line 100, in main
mod_list = [meta.get_app(app_label) for app_label in args[1:]]
  File "/usr/lib/python2.4/site-packages/django/core/meta/__init__.py",
line 68, in get_app
return __import__('%s.%s' % (MODEL_PREFIX, app_label), '', '',
[''])
  File "/usr/lib/python2.4/site-packages/django/models/__init__.py",
line 13, in ?
modules = meta.get_installed_model_modules(__all__)
  File "/usr/lib/python2.4/site-packages/django/core/meta/__init__.py",
line 103, in get_installed_model_modules
mod = __import__('django.models.%s' % submodule, '', '', [''])
  File "/home/julo/django/myproject/apps/polls/models/polls.py", line
3, in ?
class Poll(meta.Model):
  File "/home/julo/django/myproject/apps/polls/models/polls.py", line
4, in Pollquestion = meta.CharField(maxlength=200)
TypeError: __init__() takes at least 2 non-keyword arguments (1 given)
[EMAIL PROTECTED]:~/django/myproject$



Re: tutorial 1 sql problem

2005-09-06 Thread julo

Thanks.
I did it completely again and now it works. No idea why.
Julo



Re: tutorial 1 sql problem

2005-09-06 Thread julo

Thanks.
I did it completely again and now it works. No idea why.
Julo



Re: How to prevent save/delete in the Admin

2015-03-29 Thread Julo
Maybe you can add an interface for the models that are importants and hook to 
the save/delete signal a interfaced function called CanSave()
And you check the premisson he has, if not allowed rais an exception, and don't 
save.
Sorry for the bad english.
Saludos,
Julian 
-Original Message-
From: Mike Dewhirst 
Sender: django-users@googlegroups.com
Date: Sun, 29 Mar 2015 19:07:17 
To: 
Reply-To: django-users@googlegroups.com
Subject: How to prevent save/delete in the Admin

At the moment "has_change_permission" in the Admin works by returning
403 Forbidden if it gets a False.

That doesn't suit my needs but it is probably not advisable to adjust it.

Users without change permission need to be able to see the data and
perhaps raise an exception (in this case BusinessRuleViolation
subclassed from ValidationError) if they try to save. In other words,
maybe use the existing form clean() mechanism.

However, I recognise that this subverts the Admin by preventing [Save]
and therefore may not be appropriate.

A perhaps better solution would be to disable the Save and Delete
widgets/actions in particular circumstances.

How can I do something like this?

TL;DR

All the business rule decision logic is calculated using the object
instance and request.user.

The application displays a substance record with a few 1:1, 1:n, n:1 and
n:m related records. The substance has a status field which can be made
"public domain".

The business rule is that a user can see and edit all their own
substances but can see nothing owned by anyone else - unless they have
been put in the public domain (and which then must be readonly to the
"public")

Thanks for any ideas

Mike

-- 
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/5517B2B5.7020805%40dewhirst.com.au.
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/545655854-1427617702-cardhu_decombobulator_blackberry.rim.net-1563162238-%40b1.c1.bise6.blackberry.
For more options, visit https://groups.google.com/d/optout.


Re: Comments in real time

2014-08-22 Thread Julo
If you need to save the comments, take a look to django-angular.
Its an integration of angularJS into django.
Where you can save the model via javascript, i really recommend you Angular for 
this.
-Original Message-
From: Collin Anderson 
Sender: django-users@googlegroups.com
Date: Fri, 22 Aug 2014 10:37:22 
To: 
Reply-To: django-users@googlegroups.com
Subject: Re: Comments in real time

You could also look into the EventSource JavaScript API.

-- 
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/4df79594-fc7d-42be-acec-4c2385afe10a%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/654126984-1408733507-cardhu_decombobulator_blackberry.rim.net-1221296711-%40b18.c1.bise6.blackberry.
For more options, visit https://groups.google.com/d/optout.


Re: VIdeo Lectures ?

2014-10-06 Thread Julo
Godjango.com !!
Really cool videos!
-Original Message-
From: rishabh yadav 
Sender: django-users@googlegroups.com
Date: Mon, 6 Oct 2014 07:08:20 
To: 
Reply-To: django-users@googlegroups.com
Subject: VIdeo Lectures ?

Can anyone of u suggest me any good video tutorials for django ?

-- 
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/f669876b-4156-4488-a4ac-820962187134%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/1412597623-1412605718-cardhu_decombobulator_blackberry.rim.net-218218150-%40b16.c1.bise6.blackberry.
For more options, visit https://groups.google.com/d/optout.


Facebook permisson - django-allauth

2014-08-16 Thread Julo Waks
I have this problem,
i am working in an app that uses django-allauth for login with facebook.
When i ask for login i need to ask for publish_stream scope.
In local environment this work great.
In production does not.

Does anyone have a clue?

here my settings/base.py

SOCIALACCOUNT_PROVIDERS = {
> 'facebook': {
> 'SCOPE': ['email', 'publish_stream'],
> 'METHOD': 'oauth2'  # instead of 'oauth2'
> }
> }


thanks in advanced.

-- 
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/CAKSEZ1GYWVyr%2Bjmjw1ZtA1K8Uec3%3DMWPyeHcQfbvLct%2BmstMzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Constants values and best practices

2014-08-28 Thread Julo Waks
Good day!
How are you?
I have the following situation:

In more than one django project I come across the situation where I need to
define a model that has a State.
So what I usually do is:

# Pseudo code here

def State (models.Model):
 name = models.CharField ()

def Purchase (models.Model):
 # Fields various (name, descrption, etc)
 State = models.ForgeinKey (State)
 # More fields ...

The problem arises when I want to do things like:

if (Purchase.State_id == 1):

# Do stuff


my way to fix it so far was to define a const.py and do something like:

if (== Purchase.State_id Const.STATE_EGGS):

# Do stuff

Because the state 1 is "eggs", but because I add in my local, but if
another dev adds in staging, as that uniformity is maintained?
It should create a process that creates the updates as new constants was
defined?
There are best practices for this?

Ideas? Advice?

Thank you very much for reading =)

regards,
Julian.

-- 
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/CAKSEZ1EfdSiaNwd6ZxL0NUhfn3HM39zdbg1CVkRXNyObwLxjcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Best way of render differnt types of a Model

2014-09-17 Thread Julo Waks
Good day list!
After much dealing with this problem I decided to share it with fresh minds
to get a new perspective.

situation:
In the project we have a model that is Promo, which in turn has different
types of promos (FK to Promo models) and these types of promo are different
and  defined  which things should be displayed.
Now  when users access / promo / 1 /, what we do is nested if askinf for
the type of promo and then setting the template_name and o_promo (model
specific type promotion)
Obviously this design is not very scalable because if one day there are 10
types of promos, have 10 if is not the most Pythonic.
The solution I found is to define the model of a method that is Promo
get_promo_handler () and return a class according to the type of promo is
promo and that has methods like render () or other methods for logic
necesaarios project (generate coupons, decide if the promotion is finished,
etc.)

The example code is here [0]

Being new to python I open a lot of doubts.

1 is the best solution for this? What other ways are there?
2 I am implementing the best way?
3 I am using appropriately ABCMeta [1]? maybe you should use something like
__new__ [2]?
4. not quite understand is the ducktyping [3] and how it affects all this.

Thank you very much in advance,
regards,
Julo


[0] http://linkode.org/p39S0VryugbTFPXXhkVb94
[1] https://docs.python.org/2/library/abc.html
[2] https://docs.python.org/2/reference/datamodel.html#object.__new__
[3] https://docs.python.org/2/glossary.html#term-duck-typing

put all the links because they are using to try to understand the
components.

-- 
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/CAKSEZ1EG01XkE_fkuvyJihH751r06WPwYLtPNYqLsxJwfhc_oA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.