Re: my first (public) app: django-requires_js_css

2010-10-24 Thread Jason Persampieri
Just a quick note, I changed the name to django-requires_assets.  I
could imagine a future where this is used to pre-load images or other
assets.  The name seemed a bit more future-proof.

http://github.com/pappy74/django-require_assets

On Oct 20, 10:01 pm, Jason Persampieri  wrote:
> http://github.com/pappy74/django-requires_js_css
>
> Howdy folks,
>
> I was hoping to get some feedback on my first public app, django-
> requires_js_css.  The app's purpose is to allow 'sane' JavaScript and
> CSS requirements.  That is, require from within templates, but still
> load using 'best practices'.
>
> Definitely a work in progress, although we are using it at our
> startup.  My questions to you:
> - Is there another app that does this?
> - Do other devs find this worthwhile?
> - What's missing?
> - I currently use a fairly gnarly hack to make this all work
> (embedding tokens in the response content, then post-processing those
> tokens using middleware).  Is there a better way?
>
> _jason

-- 
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: Forms: set required value at runtime

2010-10-24 Thread bobo
> Bence,
>
> I think your problem is related to the second case described in
> documentation about validation fields that depend on each other [1].
>
> Just an observation about your design, if I may: I believe you should
> explicitly set and store both addresses. You will ease user task by
> providing a widget that will set the second address according the first,
> activated or not by default (I prefer not as your helper offer a direct
> one click "auto-fill" as you can encounter in many date fields with
> "today" button).
>
> Regards
>
> [1]http://docs.djangoproject.com/en/dev/ref/forms/validation/#cleaning-a...

Many thanks! With inserting to the ErrorList, I could solve the
problem:
def clean(self):
data = self.cleaned_data
if not data.has_key('same'):
if data['post_address'] == '':
 
self.errors.update(post_address=ErrorList([_("required")]))

Thanks again!

-- 
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: inheriting User class

2010-10-24 Thread Miguel Araujo
¿no one knows anything about this?

Thanks, regards
Miguel Araujo

2010/10/22 Miguel Araujo 

> Hello everyone,
>
> I'm not very aware about what's the direction Django is taking about the
> User model and making it swappable. Meanwhile I would like to ask if
> inheriting the User class is advisable or not. As I have read many places
> obscure bugs can happen and my code will be in production.
>
> I'm using now an AUTH_PROFILE_MODULE at the moment, but I don't realy like
> this approach, as it makes my class hierarchy more complicated.
>
> Thanks, best regards
> Miguel Araujo
>

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



trouble installing django & connecting to irc

2010-10-24 Thread Michael Scull
Hi,
I'm having trouble installing django and connecting to irc.

-- 
Mit freundlichen Grüßen / Best Regards,
Michael D Scull

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



Slug auto-complete after save

2010-10-24 Thread Alex
Hi all,

Slug autocomplete feature is really cool with:

prepopulated_fields = {'slug':('title',)}

Is it possible to prepopulating slug field even after save - when I
want to change title for example?

Actually I use django-multilingual and prepopulating of slug works
only for the first language (en for example), when I switch to another
language tab (es for example) - the entity is already saved and I have
now prepopulating for Spanish language.

Is it possible to solve this issue somehow?

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



Embed the file system path to a template??

2010-10-24 Thread Joakim Hove
Hello,

to assist those responsible for the content of "my" site I would like
to embed the file-system path to the template in the rendered
template, so that when they find something they are dissatisfied with
on a page they can do "View Source" and easily identify the correct
template to update.

I.e. I would like to embed something like this at the top of all the
templates:



Is this possible?

Joakim

-- 
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: trouble installing django & connecting to irc

2010-10-24 Thread Shawn Milochik
On Sun, Oct 24, 2010 at 6:26 AM, Michael Scull  wrote:
> Hi,
> I'm having trouble installing django and connecting to irc.
>
> --
> Mit freundlichen Grüßen / Best Regards,
> Michael D Scull
>

If you want help, please look up the exact error output you're getting
in the "Search this Group" box here:
http://groups.google.com/group/django-users?pli=1

If you can't fix it that way, post the output to this mailing list
telling us what you've tried so far that didn't work, and we will
probably be able to help.

Shawn

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



Linky

2010-10-24 Thread Venkatraman S
Hi Guys,

Just thought of starting a thread with some useful links in the Django
World:

http://djangopluggables.com/
http://www.djangofoo.com/
Django in Depth (PyCon 2010) http://djangocon.blip.tv/file/3322277/
http://lightbird.net/dbe/
Converting Django models into Graphviz DOT files :
http://code.djangoproject.com/wiki/DjangoGraphviz
http://opensource.washingtontimes.com/projects/
http://stackoverflow.com/questions/550632/favorite-django-tips-features

-V-
http://twitter.com/venkasub

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



How to customise a ModelForm and retain validation?

2010-10-24 Thread Brendon
Hi all,

Is there some way of creating a single form that combines multiple
Models (Auth, User and AuthPermissions as seen in my example below)
and treats them as a single object (not a relation of multiple
objects)?

I tried to do this myself using the code below. When I use it the
user.save() will raise a DB Integrity error if I enter an already used
username in the form. I thought the DJango ModelForm validation should
take care of this when calling form.is_valid().

What I am trying to do is have a single form that "merges" all the
information for the relevant models instead of having the user see
relations between the models.

Internally in our system the User and Auth records must be separate as
we have other methods of authenticating not just using a username/
password from a User record. This also means I have not found a way of
using the standard DJango authentication system. But it would be good
to leave that for another thread.

I am currently using DJango 1.2.1


Thanks,
Brendon.


#
# Models
#
class Permission(models.Model):
name = models.CharField(max_length=128, primary_key=True,
choices=PERM_DESCRIPTIONS.items())

class Auth(models.Model):
id  = models.AutoField(primary_key=True)
developer   = models.ForeignKey(Developer, null=True)
application = models.ForeignKey(Application, null=True)
permissions = models.ManyToManyField('Permission',
db_table='AuthPermissions')

class User(models.Model):
id = models.AutoField(primary_key=True)
auth   = models.OneToOneField(Auth)
username   = models.CharField(max_length=128, unique=True)
pwhash = models.CharField(max_length=128)


#
# Custom Form
#
class UserForm(django.forms.ModelForm):
scope= django.forms.ChoiceField()
password = django.forms.CharField(max_length=128,
widget=forms.PasswordInput())
password_confirm = django.forms.CharField(max_length=128,
widget=forms.PasswordInput())
permissions  =
django.forms.MultipleChoiceField(choices=models.PERM_DESCRIPTIONS.items(),
required=False)

class Meta:
model = core.User
fields = (
'scope',
'username',
'password',
'password_confirm',
'permissions')

def clean(self):
cd = self.cleaned_data
if cd.get('password') != cd.get('password_confirm'):
raise forms.ValidationError(u'Password confirmation 
didnt match')
return cd

def SetScopeChoices(self, request, choices):
if request.method != 'GET':
self.fields['scope'].choices = choices

if len(choices) == 1:
self.fields['scope'].widget = 
django.forms.widgets.HiddenInput()
self.fields['scope'].initial = choices[0][0]
else:
self.fields['scope'].widget.choices = choices
self.fields['scope'].initial = choices[0][0]



#
# View
#
@require_login
def HTMLUserCreate(request):

# Calculate the choices available for creating a new users scope
choices = wutils.GetScopeChoiceList(request.dan_auth)

if request.method == 'GET':
form = UserForm()
form.SetScopeChoices(request, choices)

elif request.method == 'POST':
form = UserForm(data=request.POST)
form.SetScopeChoices(request, choices)

if form.is_valid():
# Obtain the users form data
cd = form.cleaned_data
(developer_id, application_id) = 
ScopeIDStrToDevApp(cd['scope'])

# Create the auth object
auth = core.Auth(
developer_id=developer_id,
application_id=application_id)
auth.save(force_insert=True)

# Add permissions to the auth
auth.permissions=cd['permissions']
auth.save()

# Create the user object for the new auth object
user = core.User(
id=auth.id,
auth=auth,
username=cd['username'],
pwhash=HashPassword(cd['password'])
)

user.save(force_insert=True)
return HttpResponseRedirect('/user/'+str(user.id)+'/')

return render_to_response('user_create.html', {'form': f

How to switch L10N off in django

2010-10-24 Thread alecs
LANGUAGE_CODE = 'ru-RU'

USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = False
{{ post.date_added|date:"b" }} gives "окт" in templates.

If I set USE_I18N = False then it gives oct as it should be. Is this a
bug ? How can I solve this problem ? Are there any possibilities to
disable USE_I18N in template (in part of 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-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.



Users table

2010-10-24 Thread miksayer
Hello! I'm newbie in Django. And I have few questions. For learning
Django I decided to develop simple todo-service(where you can note
your current deals).
I started new project "todo" and immediately I have a question. Where
can I put users table model? Must I create new application and put it
there in models.py?
I don't ask 'how can I do it?', I ask 'how must I do it?'(i.e. 'how
to?').
P.S. sorry for my bad English.

-- 
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: my first (public) app: django-requires_js_css

2010-10-24 Thread Doug
I'm also interested in something like this.  I've tried it a couple of
different ways, but have not been all the happy with the results/
implementation.  It seemed like post-parsing for tokens was trouble
since it hurt performance somewhat, and gets ugly if you are serving
the occasional big file or using a generator for output.  I also tried
tracking via a threadlocals global and letting my 'content' render
once to get it updated and then feeding that into another render with
the barebones html/head/body sections.  That last one has been working
for a couple of years, but the shame keeps me up at night sometimes.

What I would really love is a way to extend the template parser to
allow for a rendering order per-block, so that some portions of the
template (ie head includes in this case) can be deferred until the
last pass and examine the context for various media 'requests' made by
tags (or other related logic).  I had also thought that preprocessing
the nodelists into order queues could allow for a kind of automatic
generator to be made so that multiple nodelists of the same order
could be yielded to the response to stream the output (though doing
that would prevent the automatic css/js stuff).  I don't know if any
of this is even reasonably possible with the current template system,
but I'd sure love if it was.

An easy but ugly approach might be a template tag that 'wraps' the
entire template:


{% delayedrender %}

 {% defer %}This stuff gets rendered last{% enddefer %}


This stuff gets rendered first

{ % enddelayedrender %}


Unfortunately I haven't had enough time to explore either option any
further.

-- 
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: Users table

2010-10-24 Thread Miguel Araujo
Hi,

Django has a built in User model, If you put in your INSTALLED_APPS
'django.contrib.auth' you will activate Django's built-in user management
app. Then if you want to have registration, I recommend you look at
django-registration by James Bennett:

http://bitbucket.org/ubernostrum/django-registration/

Regards,
Miguel Araujo


2010/10/24 miksayer 

> Hello! I'm newbie in Django. And I have few questions. For learning
> Django I decided to develop simple todo-service(where you can note
> your current deals).
> I started new project "todo" and immediately I have a question. Where
> can I put users table model? Must I create new application and put it
> there in models.py?
> I don't ask 'how can I do it?', I ask 'how must I do it?'(i.e. 'how
> to?').
> P.S. sorry for my bad English.
>
> --
> 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.
>
>

-- 
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: Users table

2010-10-24 Thread Tran Cao Thai
http://www.lightbird.net/dbe/index.html

Very good for beginners

On Mon, Oct 25, 2010 at 8:53 AM, Miguel Araujo  wrote:
> Hi,
> Django has a built in User model, If you put in your INSTALLED_APPS
> 'django.contrib.auth' you will activate Django's built-in user management
> app. Then if you want to have registration, I recommend you look at
> django-registration by James Bennett:
> http://bitbucket.org/ubernostrum/django-registration/
>
> Regards,
> Miguel Araujo
>
> 2010/10/24 miksayer 
>>
>> Hello! I'm newbie in Django. And I have few questions. For learning
>> Django I decided to develop simple todo-service(where you can note
>> your current deals).
>> I started new project "todo" and immediately I have a question. Where
>> can I put users table model? Must I create new application and put it
>> there in models.py?
>> I don't ask 'how can I do it?', I ask 'how must I do it?'(i.e. 'how
>> to?').
>> P.S. sorry for my bad English.
>>
>> --
>> 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.
>>
>
> --
> 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.
>

-- 
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: my first (public) app: django-requires_js_css

2010-10-24 Thread Sam Lai
On 21 October 2010 16:01, Jason Persampieri  wrote:
> http://github.com/pappy74/django-requires_js_css
>
> Howdy folks,
>
> I was hoping to get some feedback on my first public app, django-
> requires_js_css.  The app's purpose is to allow 'sane' JavaScript and
> CSS requirements.  That is, require from within templates, but still
> load using 'best practices'.

Another item off my to-do list. Thanks!

> Definitely a work in progress, although we are using it at our
> startup.  My questions to you:
> - Is there another app that does this?

Not that I know of.

> - Do other devs find this worthwhile?

Yep. My use case was to allow the addition of SyntaxHighlighter
brushes as required by the posts on the page. (This is now moot as of
the new version of SH, as it will now dynamically load brushes, but I
can envision other use cases for this.)

> - What's missing?
> - I currently use a fairly gnarly hack to make this all work
> (embedding tokens in the response content, then post-processing those
> tokens using middleware).  Is there a better way?

Other than how it is implemented now, the nicer way is what Doug has
described. Not sure if it is possible though/might require some Django
patches.

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

-- 
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: Custom filterspecs - ManyToMany, but inverted

2010-10-24 Thread thorstenkranz
Hi,

does really nobody have an idea how to do it? It would be so great if
somebody could help me. I guess it can'T be that dificult...

Greetings,

Thorsten

On 21 Okt., 09:09, thorstenkranz  wrote:
> Hi,
>
> I'm trying to get some filter for my admin page on a ManyToManyField.
> When I add it to the list_filter of the model admin, the filtering
> works like a charm. But this is not what I want: I'd like to invert
> the results, i.e. I want that only those list entries remain that do
> NOT have this external key in their ManyToManyField. How can I do
> this? I guess I could subclass ChoicesFilterSpec and register it, but
> I do not really know how to invert the selection...
>
> I hope I explained sufficiently well what I want. Thanks in advance
> for your help.
>
> Greetings,
>
> Thorsten

-- 
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: Django and Flux

2010-10-24 Thread Sells, Fred
Agree.  We do the same.  It's much easier if you have a dual monitor
setup and flex on one and django on the other.  I use XML rather than
pyAMF because it was easier to debug.  Just create an xml file and set
your HttpService.url to that in Flex; then later make Django generate
the same thing.  I have ~3 xml templates that support my entire app.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Tim Sawyer
Sent: Monday, October 18, 2010 8:23 AM
To: django-users@googlegroups.com
Subject: Re: Django and Flux

> You cant combine Django and Flex Builder - but you can write apps
using
> Django and Flex.

With Flex 3 (and maybe 4, I don't know) you could install it as an
Eclipse
Plugin, instead of standalone.  You could then install pydev into
Eclipse
as well, and edit both sides of the app in the same Eclipse instance.

Having said that, we use Flex standard install for Flex development, and
a
seperate Eclipse isntance for the back ends (Java/Python/Whatever).
It's
more stable that way.

Tim.

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


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



Getting unicode string from URL

2010-10-24 Thread Morten Pedersen
Dear folks

I am working on an rest API. Here some objects with weird letters in them are 
requested by the client using percent escaping (This is beyond by control).
So a request for:  
http://example.com/auth/groups/KØVS/

Is requested like so:
http://example.com/auth/groups/K%2BVS/

When i get this value in my Django view i need it as a regular or Unicode 
string but i cannot seem to figure out how.

Niether:
urllib.unquote_plus(variable)
Nor:
urllib.unquote_plus(variable).encode('UTF8')

...reassembles the original string... what am i missing?

Best wishes
Morten Pedersen
Denmark

-- 
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: inheritance of fields and default values from parent model class

2010-10-24 Thread Phlip
pixelcowboy wrote:

> Hi, I would like to create an inheritance relationship, similar to an
> abstract class, where the child class inherits all thefieldsfrom the
> parent class, but also gets its default values from the parent
> instance. So basically Im confused about the concepts, I know an
> abstract class would not have a particular instance, but I would like
> the child class toinheritthefieldsand field values from an actual
> parent instance, but with the capability of overriding them.

I have a related problem. And so did this guy, some years ago:

zeliboba wrote:

> I'd like to have certainfieldsin several models, like alias field in
> this:
>
> class Person(models.Model):
>     name = models.CharField(max_length=255)
>     alias = models.ForeignKey('self', blank=True, null=True)
>
> class Place(models.Model):
>     street = models.CharField(max_length=255)
>     alias = models.ForeignKey('self', blank=True, null=True)
>
> to repeat alias in everymodelis not DRY. also I'd like to have
> Manager returning for example all aliases for all of such models 
> andmodelmethods to manipulate with aliases. so it should be common for
> several models. I see a way to achieve this is toinherit
> models.Model, add necessaryfields/managers/methods to it and theinheritmy 
> models from it, like:
>
> class MyModel(models.Model):
>     alias = models.ForeignKey('self', blank=True, null=True)
>     manager = [my alias manager here]
>     def getAlias:
>           [whatever I need]
>
> class Person(MyModel):
>     name = models.CharField(max_length=255)
>
> class Place(MyModel):
>     street = models.CharField(max_length=255)
>
> my questions are:
> 1. is it the right way to go?
> 2. are there any pitfalls?

What we discovered doing that is we get an extra database table called
_mymodel, and we don't need it.

So then I tried it like this:

 class MyModel:
     alias = models.ForeignKey('self', blank=True, null=True)
     manager = [my alias manager here]

 class Person(models.Model, MyModel):
    name = models.CharField(max_length=255)

 class Place(models.Model, MyModel):
     street = models.CharField(max_length=255)

And now the model can't see the fields 'alias' or 'manager'.

How do I (redundantly!) give the two model records the same
boilerplate fields?

--
  Phlip
  http://zeekland.zeroplayer.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-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: inheriting User class

2010-10-24 Thread Rob
Probably most of us are using the separate profile model, as
recommended.

I actually have multiple models associated with users on one project:

User (from auth)
UserInfo (things rarely accessed such as address, emergency contact
info, etc.)
UserProfile (my application specific profile)

I'm going to break UserProfile into EmployeeProfile and StudentProfile
at some point or keep UserProfile add the other two profile types.
Depends on how looking into Django model polymorphism goes :-)

I prefer the separation of profile and login in my case.  Many
students do not want or need logins to the system.




On Oct 24, 6:32 am, Miguel Araujo  wrote:
> ¿no one knows anything about this?
>
> Thanks, regards
> Miguel Araujo
>
> 2010/10/22 Miguel Araujo 
>
>
>
>
>
>
>
> > Hello everyone,
>
> > I'm not very aware about what's the direction Django is taking about the
> > User model and making it swappable. Meanwhile I would like to ask if
> > inheriting the User class is advisable or not. As I have read many places
> > obscure bugs can happen and my code will be in production.
>
> > I'm using now an AUTH_PROFILE_MODULE at the moment, but I don't realy like
> > this approach, as it makes my class hierarchy more complicated.
>
> > Thanks, best regards
> > Miguel Araujo

-- 
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: inheritance of fields and default values from parent model class

2010-10-24 Thread Phlip
> > class MyModel(models.Model):
> >     alias = models.ForeignKey('self', blank=True, null=True)
> >     manager = [my alias manager here]
> >     def getAlias:
> >           [whatever I need]
>
> > class Person(MyModel):
> >     name = models.CharField(max_length=255)
>
> > class Place(MyModel):
> >     street = models.CharField(max_length=255)

> What we discovered doing that is we get an extra database table called
> _mymodel, and we don't need it.

http://docs.djangoproject.com/en/1.0/topics/db/models/

Here we go!

class CommonInfo(models.Model):
name = models.CharField(max_length=100)
age = models.PositiveIntegerField()

class Meta:
abstract = True

class Student(CommonInfo):
home_group = models.CharField(max_length=5)

-- 
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: Is there some way to log every SQL command sent to the DB?

2010-10-24 Thread m1chael
You could turn on logging through your DB

On Sat, Oct 23, 2010 at 12:30 PM, Phlip  wrote:
> Google leads me to this:
>
>        from django.db import connection
>        print connection.queries
>
> It can't see the queries the test runner used to set up the database.
>
> So, how to log every SQL command to a log file? (Like RoR can?)
>
> --
>  Phlip
>
> --
> 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.
>
>

-- 
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: What does an ideal django workflow setup look like?

2010-10-24 Thread Kenneth Gonsalves
On Sat, 2010-10-23 at 08:41 -0700, shacker wrote:
> On Oct 22, 10:09 pm, Kenneth Gonsalves  wrote:
> 
> > 5. Note: settings.py is not put under version control as this holds
> > sensitive information and paths differ according to the server it is
> on.
> > I create a default.settings.py which has the sensitive information
> > removed. That is kept under version control.
> 
> Another approach to this problem:
> 
> settings.py IS in version control and includes settings that are
> universal to all environments (local dev, staging, production), but
> has dummy info or empty strings for passwords or paths or other
> information that vary between environments. 

this is a better approach - much more professional (I *did* say I am an
amateur;-))
-- 
regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

-- 
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: What does an ideal django workflow setup look like?

2010-10-24 Thread Steve Holden
On 10/25/2010 2:02 AM, Kenneth Gonsalves wrote:
[shacker]
>> Another approach to this problem:
>> 
>> settings.py IS in version control and includes settings
>> that are universal to all environments (local dev, staging,
>> production), but has dummy info or empty strings for
>> passwords or paths or other information that vary between
>> environments.
> this is a better approach - much more professional (I *did* say I
> am an amateur;-))

A technique I use, having picked it up from Jacob Kaplan Moss, IIRC, is
to keep settings.py under source control but have it include as its last
statement

from local_settings import *

The local_settings.py file is then maintained outside source control on
each target platform. This works very nicely, and allows you to maintain
common settings without having to edit a file that's under code control
to vary settings between platforms.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

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