Teradata - BE Module

2020-12-15 Thread Norbert Stréling
Hi All,

I have a corporate web app project which should be set on Teradata DWH. I 
have been looking for TD back end django module. 
I have found one, however it is not finished yet.

Does anyone know initiatation regarding such django development?

Thanks in advance.

Cheers,
Norbil

-- 
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/bed83d1c-cc6c-40df-a4ed-5fecc2c71ea8n%40googlegroups.com.


Re: Documentation misspelling - Django 3 - maybe

2020-03-06 Thread Norbert Rácz
You're right. And I don't know what I saw, but now it isn't working either 
way.

2020. március 6., péntek 0:02:58 UTC+1 időpontban Andréas Kühne a 
következőt írta:
>
> If you check the code for the PasswordChangeView, the default template is 
> 'registration/password_change_form.html'. So you are incorrect.
>
> Regards,
>
> Andréas
>
>
> Den ons 4 mars 2020 kl 18:19 skrev Norbert Rácz  >:
>
>> Here: 
>> https://docs.djangoproject.com/en/3.0/topics/auth/default/#django.contrib.auth.views.PasswordChangeView
>>
>> This line: template_name: The full name of a template to use for 
>> displaying the password change form. Defaults to 
>> registration/password_change_form.html if not supplied. 
>>
>> The "password_change_form.html" not workinkng for me, but 
>> "password_change.html" is ok, when I want to made a costum template. I 
>> think it was working at Django 2 with "_form". What you think? I'm right? 
>> And where can I report that?
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/fc1f10af-efd6-487c-9777-4cd486b5186a%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/fc1f10af-efd6-487c-9777-4cd486b5186a%40googlegroups.com?utm_medium=email&utm_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/1ed3bd5f-c306-4bf2-86c1-f7ceae5fd424%40googlegroups.com.


Documentation misspelling - Django 3 - maybe

2020-03-04 Thread Norbert Rácz
Here: 
https://docs.djangoproject.com/en/3.0/topics/auth/default/#django.contrib.auth.views.PasswordChangeView

This line: template_name: The full name of a template to use for displaying 
the password change form. Defaults to 
registration/password_change_form.html if not supplied. 

The "password_change_form.html" not workinkng for me, but 
"password_change.html" is ok, when I want to made a costum template. I 
think it was working at Django 2 with "_form". What you think? I'm right? 
And where can I report that?


-- 
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/fc1f10af-efd6-487c-9777-4cd486b5186a%40googlegroups.com.


South trunk with Django trunk? (wierd error)

2010-02-19 Thread Norbert Wójtowicz
Howdy,

Just started a new project with Django trunk (have been using Django 1.1
lately, so please bare with me).

After I got a basic setup going I installed the latest release of south, but
that bombed spectacularly with database errors in settings.py. Oh, right -
that multi-database switch! I see the south tracker had a multi-database
commit at some point, so being the lazy programmer that I am, I just grabbed
south trunk. And my error messages were 'upgraded' on the gibberish scale.

1. Does current south-trunk play nice with django-trunk? If not, maybe this
is a fool's errand?

2. I'm hoping it's just User Error on my part. Here's the error I can't
grok:

$ ./django/bin syncdb
$ ./django/bin convert_to_south locations (or any other app)

Traceback (most recent call last):
  File "./bin/django", line 22, in 
djangorecipe.manage.main('kit.settings_dev')
  File
"/home/norbert/.buildout/eggs/djangorecipe-0.19.2-py2.6.egg/djangorecipe/manage.py",
line 16, in main
management.execute_manager(mod)
  File
"/home/norbert/code/new1000it/parts/django/django/core/management/__init__.py",
line 438, in execute_manager
utility.execute()
  File
"/home/norbert/code/new1000it/parts/django/django/core/management/__init__.py",
line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/home/norbert/code/new1000it/parts/django/django/core/management/base.py",
line 195, in run_from_argv
self.execute(*args, **options.__dict__)
  File
"/home/norbert/code/new1000it/parts/django/django/core/management/base.py",
line 222, in execute
output = self.handle(*args, **options)
  File
"/home/norbert/code/new1000it/kit/compat/south/management/commands/convert_to_south.py",
line 47, in handle
if Migrations(app):
  File "/home/norbert/code/new1000it/kit/compat/south/migration/base.py",
line 60, in __call__
self.instances[app_label] = super(MigrationsMetaclass,
self).__call__(app_label_to_app_module(app_label), **kwds)
  File "/home/norbert/code/new1000it/kit/compat/south/migration/base.py",
line 84, in __init__
self.set_application(application, force_creation, verbose_creation)
  File "/home/norbert/code/new1000it/kit/compat/south/migration/base.py",
line 155, in set_application
raise exceptions.NoMigrations(application)
south.exceptions.NoMigrations: Application '' has no
migrations.


3. Maybe south has a new procedure for converting apps?

I'd really appreciate any guidance or divine intervention.

Thanks,
Norbert

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



MultipleForm factory and optional forms

2009-10-26 Thread Norbert Wójtowicz

I've borrowed Alex Gaynor's code for building MultipleForm factories
[0] and updated it to work with optional form fields.

The idea comes from the following situation: you have a profile page
with many services (eg. blip, twitter, etc) that you link to via
ForeignKey.

class MicroBlog(models.Model):
service = models.IntegerField(choices=SOCIAL_MEDIAS)
nick = models.CharField(max_length=50)
# other stuff (eg. verification, update_date, etc)

You would like to build the profile page quickly - so you use a
ModelForm and the MultipleForm factory.

class MicroBlogForm(forms.ModelForm):
class Meta:
model = MicroBlog

BigProfileForm = multiple_form_factory({
'twitter': SocialMicroBlogForm,
'flaker': SocialMicroBlogForm,
# other kinds of forms (so can't really use querysets.. I
think. I could be wrong!)
}, ['twitter', 'flaker'])

The only problem with this is that all submitted forms should validate
BUT not all forms are required. For example, we can't expect everyone
to have a twitter account. One way is to make the fields optional (but
then we need to validate outside of forms), so the only real way to do
it is to mark optional forms.

I've modified Alex's code to support optional fields:

BigProfileForm = multiple_form_factory({
'twitter': SocialMicroBlogForm,
'flaker': SocialMicroBlogForm,
}, ['twitter', 'flaker']
  , ['twitter']) # twitter is optional, flaker
is required

The modified code is posted below. If possible, I'd appreciate some
comments if this is the right way to go about it. Also, there's one
bug I can't figure out - if an empty form is submitted (without any
data), the rendered form shows required field errors on all forms
(even optional). The correct handling is to only show required field
errors on optional fields that had some data submitted. Could someone
point out where my problem is?

Code:

from django.forms.util import ErrorList
from django.utils.datastructures import SortedDict
from django.utils.safestring import mark_safe

def multiple_form_factory(form_classes, form_order=None,
optional_forms=[]):
   if form_order:
   form_classes = SortedDict([(prefix, form_classes[prefix])
  for prefix in form_order])
   else:
   form_classes = SortedDict(form_classes)
   return type('MultipleForm', (MultipleFormBase,),
   {'form_classes': form_classes,
'optional_forms': optional_forms})

class MultipleFormBase(object):
   def __init__(self, data=None, files=None, auto_id='id_%s',
prefix=None, initial=None, error_class=ErrorList,
label_suffix=':', empty_permitted=False):
   initial = initial or {}
   if prefix is None:
   prefix = ''
   self.forms = []
   self.extra_forms_info = []
   for i, (form_prefix, form_class) in enumerate
(self.form_classes.iteritems()):
   self.extra_forms_info.append({
   'prefix': form_prefix,
   'optional': form_prefix in self.optional_forms,
   })
   self.forms.append(form_class(data, files, auto_id, prefix +
form_prefix,
   initial.get(i, None),
   error_class, label_suffix,
empty_permitted))

   def __unicode__(self):
   return self.as_table()

   def __iter__(self):
   for form in self.forms:
   for field in form:
   yield field

   def non_optional_forms(self):
   for i,form in enumerate(self.forms):
   if self.extra_forms_info[i]['optional'] and not
form._get_changed_data():
   continue
   yield form

   def is_valid(self):
   # raise Exception, list(self.non_optional_forms())
   return all(form.is_valid() for form in self.non_optional_forms
())

   def as_table(self):
   return mark_safe('\n'.join(form.as_table() for form in
self.forms))

   def as_ul(self):
   return mark_safe('\n'.join(form.as_ul() for form in
self.forms))

   def as_p(self):
   return mark_safe('\n'.join(form.as_p() for form in self.forms))

   def is_multipart(self):
   return any(form.is_multipart() for form in self.forms)

   def save(self, commit=True):
   return tuple(form.save(commit) for form in
self.non_optional_forms())
   save.alters_data = True


Thanks in advance,
Norbert Wójtowicz

[0] http://en.av5.info/lazypython/2009/05/eurodjangocon-2009.html

--~--~-~--~~~---~--~~
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: PayPal integration

2008-04-04 Thread Norbert

There is a recipe in ASPN 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/456361

Not tested by me and not django related but maybe it helps

On 27 Mrz., 05:54, e <[EMAIL PROTECTED]> wrote:
> Is there a tutorial or stand-alone django app somewhere that shows how
> to make a PayPal payment using their API?  Especially the Name Value
> Pair stuff.  There's nothing on PayPal's site and so far I've only
> found this:
>
> http://python.pastebin.com/f782d48d9
>
> I've tried looking through the Satchmoproject, but there's too much
> other stuff to figure out how to just make a PayPal API call.
>
> Thanks!


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



Re: Oracle Backend - syncdb

2007-11-21 Thread Norbert

Maybe you can change the tablespace in the initial sql, see here
http://www.djangoproject.com/documentation/model-api/#database-backend-specific-sql-data

Norbert

--~--~-~--~~~---~--~~
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: Automatically starting the FastCGI server

2006-11-05 Thread Norbert Wojtowicz

I am also interested in how others have solved this. I hope I'm not 
hijacking the thread, but could we see your Debian approach to this problem?

Grigory Fateyev wrote:
> Hello orestis!
> On Fri, 03 Nov 2006 18:53:26 - you wrote:
>
>   
>> Hello,
>>
>> I'm new to linux administration, but I try to learn :)
>>
>> I have managed to make lighttpd and postgresql start automatically
>> upon reboot, now I need a way to make manage.py runfcgi to start
>> automatically.
>> 
> [...] 
>   
>> Has anyone made this work ? An init.d script would be nice too, as I'd
>> like to run the django fcgi server under a different user.
>> 
>
> What OS you are working on? If Debian, can help you...
>
>   


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



TagsField app and m2m bug

2006-10-20 Thread Norbert Wojtowicz

Hello,

I tried out Ivan's tags app (http://softwaremaniacs.org/soft/tags/en/)
and got the following error at different fairly unrelated tasks (edit
object, render object in {{form.tags}}, etc).

Error:
(1064, "You have an error in your SQL syntax; check the manual that
corresponds
to your MySQL server version for the right syntax to use near '))
ORDER BY `tags_tag`.`norm_value` ASC, `tags_tag`.`value` ASC' at line 1")

Local Variables:

Select ['`tags_tag`.`id`', '`tags_tag`.`value`', '`tags_tag`.`norm_value`']
sql ' FROM `tags_tag` WHERE (`tags_tag`.`id` IN ()) ORDER BY
`tags_tag`.`norm_value` ASC, `tags_tag`.`value` ASC'

This is the culprit:

tags/fields.py
48: ids = [id for id in data if type(id) == int]
49: strs = [id for id in data if type(id) != int]
50: initial_tags = list(self.model.objects.filter(id__in=ids))

If ids is blank, the sql is 'IN ()' which is illegal in MySQL (5.0.24a).
The easy fix is something along the lines of:

if ids:
  initial_tags = list(self.model.objects.filter(id__in=ids))
else:
  initial_tags = []

The reason I'm posting this on django-users instead of just reporting
the bug to Ivan directly, is because I'm curious whether this is
"correct" behavior. If 'IN ()' is legal in postgres (could someone
verify one way or the other?) than maybe this should be ticketed as a
django-mysql bug and fixed accordingly?

I'm not sure one way or the other, so just looking for some input.

Norbert

PS. Thanks Ivan for the app! :-)



--~--~-~--~~~---~--~~
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: Confused: staff / active users

2006-09-29 Thread Norbert


> About this, I just thought that the authenticate method should require
> an active user. But it won't hurt to check myself or use the default
> AuthenticationForm.

This was my understanding as well, from reading the docs. I would consider 
an "is_active = False" to be the same as user/password did not match. After 
all, the main logic behind is_active is we want to "delete" a user without 
actually deleting him (to not create missing foreign keys).

I have not looked further into this, I just blindly assumed that a user that 
is authenticated has both supplied correct username/password and can actually 
login (ie. is_active).  The inverse situation, where we would want to check a 
user/pass even if the user cannot login, is far less likely. Maybe it would 
be appropriate to make the situations more explicit. For example, 
is_valid_user() [user exists, passwords match] and is_authenticated() 
[is_valid_user() and can actually use the system]. The method names need 
work, but I think this is a valid issue -- maybe at least make this more 
explicit in the docs.

Norbert

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

2006-06-28 Thread Norbert

> As noted in another message in this thread; this looks like your user
> object hasn't been saved before being added to the m2m object.

This was indeed the issue.

> This looks like it could be a manifestation of Ticket #1839. I'm in the
> process of looking at this one at the moment.

Please let me know if you need to know anything more, or need me for testing.

Thanks for the response!

Norbert

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



django admin errors

2006-06-28 Thread Norbert

Hello,

I have not been able to resolve this issue with people's help on irc, so I'm 
hoping to reach a larger audience.

Dependencies:
- reset all my databases
- running mod_python + apache
  (restarted more than once :)
- svn trunk (a day old at the time of writing)

Problem:
domain/admin/auth/user/1/

(this is the built-in admin, with the built-in user class)

Error:
Traceback (most recent call last):
 File "/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py" in 
get_response
   74. response = callback(request, *callback_args, **callback_kwargs) 
File 
"/usr/local/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py"
 
in _checklogin
   54. return view_func(request, *args, **kwargs) 
File "/usr/local/lib/python2.4/site-packages/django/views/decorators/cache.py" 
in _wrapped_view_func
   40. response = view_func(request, *args, **kwargs) 
File "usr/local/lib/python2.4/site-packages/django/contrib/admin/views/main.py" 
in change_stage
   316. manipulator = model.ChangeManipulator(object_id) 
File "/usr/local/lib/python2.4/site-packages/django/db/models/manipulators.py" 
in __init__
   272. super(AutomaticChangeManipulator, self).__init__(follow=follow) 
File "/usr/local/lib/python2.4/site-packages/django/db/models/manipulators.py" 
in __init__
   75. self.fields.extend(f.get_manipulator_fields(self.opts, self, 
self.change, fol))
 File "/usr/local/lib/python2.4/site-packages/django/db/models/related.py" in 
get_manipulator_fields
   112. if follow.get(f.name, False):
 
   AttributeError at /admin/auth/user/1/
   'bool' object has no attribute 'get'

Second Problem (I'm not sure, but I think it may be related to the previous):

In a custom manipulator, I'm saving a M2M.

model:
recipients = models.ManyToManyField(User, related_name="recipients")

manipulator - in .save()
for n in data['recipients']:
e.recipients.add(User.objects.get(pk=n))

part of view, which passes data to manipulator - which I simplified for 
debugging:
data['recipients'] = [User.objects.get(username='igroupsadmin').id]

'igroupsadmin' is a valid user, with an ID (I checked the database entry)

Error during manipulator.save():
 
 Traceback (most recent call last):
 File "/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py" in 
get_response
   74. response = callback(request, *callback_args, **callback_kwargs) 
File "/usr/local/lib/python2.4/site-packages/django/contrib/auth/decorators.py" 
in _checklogin
   14. return view_func(request, *args, **kwargs)
 File "/srv/igroups30/igroups/igroups/emails/views.py" in send_group_email
   84. email = manipulator.save(data)
 File "/srv/igroups30/igroups/igroups/emails/views.py" in save
   46. e.recipients.add(User.objects.get(pk=n)) 
File 
"/usr/local/lib/python2.4/site-packages/django/db/models/fields/related.py" 
in __get__
   413. target_col_name=qn(self.field.m2m_reverse_name()) 
File 
"/usr/local/lib/python2.4/site-packages/django/db/models/fields/related.py" 
in __init__
   252. raise ValueError("%r instance needs to have a primary key value before 
a many-to-many relationship can be used." % model)

   ValueError at /iit/2006/summer/ipro338/email/send/
instance needs to have a primary 
key value before a many-to-many relationship can be used.

Any and all suggestions welcome, even if only for the second problem (I can 
live without admin, but I can't live without saving users). =)

Thanks in advance,
Norbert

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



django admin errors

2006-06-28 Thread Norbert Wojtowicz

Hello,

I have not been able to resolve this issue with people's help on irc, so I'm 
hoping to reach a broader audience.

Dependencies:
- reset all my databases
- running mod_python + apache
  (restarted more than once :)
- svn trunk (a day old at the time of writing)

Problem:
domain/admin/auth/user/1/

(this is the built-in admin, with the built-in user class)

Error:
Traceback (most recent call last):
 File "/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py" in 
get_response
   74. response = callback(request, *callback_args, **callback_kwargs) 
File 
"/usr/local/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py"
 
in _checklogin
   54. return view_func(request, *args, **kwargs) 
File "/usr/local/lib/python2.4/site-packages/django/views/decorators/cache.py" 
in _wrapped_view_func
   40. response = view_func(request, *args, **kwargs) 
File "usr/local/lib/python2.4/site-packages/django/contrib/admin/views/main.py" 
in change_stage
   316. manipulator = model.ChangeManipulator(object_id) 
File "/usr/local/lib/python2.4/site-packages/django/db/models/manipulators.py" 
in __init__
   272. super(AutomaticChangeManipulator, self).__init__(follow=follow) 
File "/usr/local/lib/python2.4/site-packages/django/db/models/manipulators.py" 
in __init__
   75. self.fields.extend(f.get_manipulator_fields(self.opts, self, 
self.change, fol))
 File "/usr/local/lib/python2.4/site-packages/django/db/models/related.py" in 
get_manipulator_fields
   112. if follow.get(f.name, False):
 
   AttributeError at /admin/auth/user/1/
   'bool' object has no attribute 'get'

Second Problem (I'm not sure, but I think it may be related to the previous):

In a custom manipulator, I'm saving a M2M.

model:
recipients = models.ManyToManyField(User, related_name="recipients")

manipulator - in .save()
for n in data['recipients']:
e.recipients.add(User.objects.get(pk=n))

part of view, which passes data to manipulator - which I simplified for 
debugging:
data['recipients'] = [User.objects.get(username='igroupsadmin').id]

'igroupsadmin' is a valid user, with an ID (I checked the database entry)

Error during manipulator.save():
 
 Traceback (most recent call last):
 File "/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py" in 
get_response
   74. response = callback(request, *callback_args, **callback_kwargs) 
File "/usr/local/lib/python2.4/site-packages/django/contrib/auth/decorators.py" 
in _checklogin
   14. return view_func(request, *args, **kwargs)
 File "/srv/igroups30/igroups/igroups/emails/views.py" in send_group_email
   84. email = manipulator.save(data)
 File "/srv/igroups30/igroups/igroups/emails/views.py" in save
   46. e.recipients.add(User.objects.get(pk=n)) 
File 
"/usr/local/lib/python2.4/site-packages/django/db/models/fields/related.py" 
in __get__
   413. target_col_name=qn(self.field.m2m_reverse_name()) 
File 
"/usr/local/lib/python2.4/site-packages/django/db/models/fields/related.py" 
in __init__
   252. raise ValueError("%r instance needs to have a primary key value before 
a many-to-many relationship can be used." % model)

   ValueError at /iit/2006/summer/ipro338/email/send/
instance needs to have a primary 
key value before a many-to-many relationship can be used.

Any and all suggestions welcome, even if only for the second problem (I can 
live without admin, but I can't live without saving users). =)

Thanks in advance,
Norbert

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



How can users only edit their own files?

2006-04-27 Thread Norbert

I remember reading somewhere in the docs a while back that this was not 
officially supported. Has this changed in MR, or has someone 
implemented this with a hack or two?

The idea is that the user can only delete/edit/etc their own postings - 
anything else is denied. (This is obviously not for all users, there 
need to be admins, etc who can edit everyones files). The only way I 
can think of is setting up permission groups in Users and maybe 
overwriting delete()? I haven't tried it yet, was hoping someone with 
more mojo could shed some light.

I would prefer that this was implemented in the models/views and not in 
the admin interface, but any help would be appreciated.

Thanks for any help,
Norbert

--~--~-~--~~~---~--~~
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-12 Thread Norbert

Thanks for the quick reply, Arthur.

I've gone over the MR version of doing this, by overwriting delete(), 
which seems to be like a good approach. I have not tried to add it to 
my code, because due to some bad management, I'm currently not 
working on that particular code. In a way, the problem fixed 
itself. ;-)

I will probably come back to it soon, and I intend on using it.

I also agree with Glenn. As a relative python newb, my first thought 
was "Oh, so I shouldn't raise an exception if the delete fails? Hmmm, 
probably because it would make the admin app do wierd things."

I was actually curious if it would be appropriate to take this a step 
further. Have a "can_delete()" which would check if the logged in 
user can do some action. After all, you don't want to give a user 
false hope by showing them a widget which will just return an error. 
I realize that this may be done with group permissions, but it's just 
not the same amount of control. Imagine if I allowed logged in users 
to delete their own stuff, but not someone elses. Then, you have 
managers who can delete stuff that belongs to them or to one of their 
team members. And then you have admins who can do whatever they want. 
Since Django currently doesn't have "can delete self only" 
permissions, could I fake it with a psuedo-delete inside the Model?

This would require accessing current user in the model function. Maybe 
this patch? 
http://code.djangoproject.com/attachment/ticket/1132/current_user_field_patch.2.diff

These are just some random thoughts, feel free to ignore them.

Thanks for the great software, I'm hoping to devote more time to it as 
soon as I get a chance. ;-)

Norbert.

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



Using _pre_delete() to stop execution

2006-04-11 Thread Norbert

Can I use _pre_delete() in a model to stop the deletion from 
occurring? 

I've checked the documentation, but couldn't find anything relevant. 
Someone also raised this question on the save_delete_hooks 
documentation, with no response.

Maybe throw some exception?

Has someone done this before or have any ideas?

Thanks,
Norbert

--~--~-~--~~~---~--~~
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: basic extension of users.User

2006-04-11 Thread Norbert

Thanks, that was my problem. :)

> def __repr__(self):
>  return self.get_user().get_full_name()

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



basic extension of users.User

2006-04-10 Thread Norbert

Hello,

I'm just starting out in really trying to get a Django app on its 
feet, even though I've played with it on and off for a couple weeks. 

Here's where my first cryptic error begins.
I tried extend users.User in the most basic fashion I could think of:

class Stakeholder(meta.Model):
user = meta.ForeignKey(users.User, num_in_admin=1, \
max_num_in_admin=1, unique=True, blank = True, \
null=True, default = None, edit_inline=meta.TABULAR)
company = meta.CharField(maxlength=200)

class META:
admin = meta.Admin()

def __repr__(self):
return self.user.get_full_name()

It seemed that the model worked sort of correctly (even though I could 
not figure out how to edit_inline a new user when creating a new 
stakeholder, but this not a major issue at the moment).

The problems began when I tried adding the above __repr__. The error I 
get when creating a new stakehold in the admin/ app is cryptic to me 
(I pasted it at the end of this email).

How do I correctly access User variables in this model? Should I be 
using a different approach?

I realize that it may be an obvious error, but I have gone through the 
documentation, and have not found anything relevant to my problem. 
Please help a new user from wasting many hours trying to debug 
this. :-)

I'm using MR-branch, if that is relevant. And the reason I did not use 
OneToOneField or inheritance is because I've read those options are 
not currently the best idea for extending User.

Any advice or help would be most appreciated,
Norbert.

Cryptic error when adding Stakeholder using admin interface:

Traceback (most recent call last): 
File "/usr/lib/python2.4/site-packages/django/core/servers/basehttp.py", 
line 272, in run
self.result = application(self.environ, self.start_response)  
File "/usr/lib/python2.4/site-packages/django/core/servers/basehttp.py", 
line 615, in __call__
return self.application(environ, start_response)
File "/usr/lib/python2.4/site-packages/django/core/handlers/wsgi.py", 
line 159, in __call__
response = self.get_response(request.path, request)
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py", 
line 109, in get_response
return self.get_technical_error_response(request)
 File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py", 
line 139, in get_technical_error_response
return debug.technical_500_response(request, *sys.exc_info()
  File "/usr/lib/python2.4/site-packages/django/views/debug.py", line 
126, in technical_500_response
return HttpResponseServerError(t.render(c), mimetype='text/html') 
File "/usr/lib/python2.4/site-packages/django/core/template/__init__.py", 
line 146, in render
return self.nodelist.render(context) 
File "/usr/lib/python2.4/site-packages/django/core/template/__init__.py", 
line 714, in render
bits.append(self.render_node(node, context)) 
File "/usr/lib/python2.4/site-packages/django/core/template/__init__.py", 
line 732, in render_node
result = node.render(context) 
File "/usr/lib/python2.4/site-packages/django/core/template/defaulttags.py", 
line 112, in render
nodelist.append(node.render(context)) 
File "/usr/lib/python2.4/site-packages/django/core/template/defaulttags.py", 
line 174, in render
return self.nodelist_true.render(context) 
File "/usr/lib/python2.4/site-packages/django/core/template/__init__.py", 
line 714, in render
bits.append(self.render_node(node, context)) 
File "/usr/lib/python2.4/site-packages/django/core/template/__init__.py", 
line 742, in render_node
raise wrapped
TemplateSyntaxError: Caught an exception while rendering.

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