DjangoCon US 2011: September 6-8, in Portland, Oregon

2010-11-21 Thread Russell Keith-Magee
Hi all,

The DjangoCon organizing committee, led by Steve Holden, has just
announced that DjangoCon US 2011 will be held in Portland, Oregon,
from September 6-8 2011. This will be followed by a couple of days of
sprints. We are also exploring the possibility of running tutorials on
the day before (September 5).

There will be a change of venue from the last two years -- we've
shifted to the Hilton Portland and Executive Tower [1]. This is
located right in the middle of downtown Portland, so it should be a
lot more convenient for dinner and other social activities.

The budget hasn't been finalized yet, but we will be aiming to keep
registration fees comparable to DjangoCon US 2010. However, we have
already negotiated complimentary internet for everyone staying at the
hotel, and throughout the ballroom where the conference will be taking
place.

Although there was some interest in looking at other venues, due to
the relatively short time frame, it was necessary to stick to Portland
for at least one more year. To that end -- if you are interested in
hosting DjangoCon US 2012 in a location other than Portland, now is
the time to start organizing. Jump on the DjangoCon organizers mailing
list [2] and let us know that you want to help out. And if you want to
help organize DjangoCon US 2011, jump on the same list!

Hope to see you in Portland in September!

[1] 
http://www1.hilton.com/en_us/hi/hotel/pdxphhh-hilton-portland-executive-tower-oregon/index.do
[2] http://groups.google.com/group/djangocon-organizers

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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.



AttributeError: Model object has no attribute "attributename"

2010-11-21 Thread Jean-Pierre De Villiers
Hi,

I've been using Djangos manytomany functionality to add values into the auto
generated table, here are my model classes:

class Contract_Item(models.Model):
quant = models.DecimalField(max_digits=10, decimal_places=4)
item = models.OneToOneField(Item)

class Contract(models.Model):
contract_no = models.AutoField(primary_key=True)
start_date = models.DateField()
end_date = models.DateField()
change_date = models.DateField()
contract_type = models.ForeignKey(Contract_Type)
comment = models.CharField(max_length=300)
creno = models.ManyToManyField(Creditor)
debno = models.ManyToManyField(Debtor)
contract_items = models.ManyToManyField(Contract_Item)

when i try to read values into the manytomany table with the following code:
(new_contract is the contract object i used to read values into)
new_contract = models.Contract(modelattribute=variable)
for items in i_contract_item_list:
new_contract.contract_items.add(items)
new_contract.save()

However when i run this the following error occurs and I cant seem to find
the problem:

AttributeError: 'Contract' object has no attribute 'contract_items'

Any help would be appreciated!

Thanks,

JP De Villiers

-- 
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 join a search on user and user profile

2010-11-21 Thread Rogério Carrasqueira
Hello Folks!

I'm working on my system that has 2 classes to work with user managemet:
User and UserProfile, and I would like to make on admin an unified search.
For example I would like to find a user by e-mail at User class and all User
that is female or something like that. So, Is there anyway to work on this
direction?

Thanks

Rogério Carrasqueira

---
e-mail: rogerio.carrasque...@gmail.com
skype: rgcarrasqueira
MSN: rcarrasque...@hotmail.com
ICQ: 50525616
Tel.: (11) 7805-0074

-- 
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: database relationships, many to one

2010-11-21 Thread Bruno Amaral
It Worked :)

Thank you both for the guidance.

Here's the final result in case it will help anyone else 
http://dpaste.com/278230/

On Nov 21, 5:09 pm, Carlos Daniel Ruvalcaba Valenzuela
 wrote:
> The first error is simple, university models is defined after your
> department model, thus is not found, you can define the foreign key as
> a string in the form of "appname.ModelName", so you will define it
> like this:
>
> class departments(models.Model):
>     university = models.ForeignKey("appname.university",
> related_name="departments")
>
> Where appname is the name of the application where the models are
> being defined (the folder where models.py is stored).
>
> About the other problem, it would be good to have a little more
> context on what is socialmediacourses and where is throwing you the
> error, but with the above change should do the trick, just don't
> forget to remove your ManyToMany departments definition on University
> model, that would make the name university.department clash.
>
> Regards,
> Carlos Ruvalcaba
>
>
>
> On Sun, Nov 21, 2010 at 7:10 AM, Bruno Amaral  wrote:
> > Carlos, Thank you for this!
>
> > Your solution is what I am looking for,but for some reason I get an
> > error message:
> > "NameError: name 'university' is not defined"  > 278024/>
>
> > Figuring this could an issue with Python and not Django, i added
> > university ='' to the top.
>
> > The validate command returned the message:
> > Error: One or more models did not validate:
> > socialmediacourses.departments: 'university' has a relation with
> > model , which has either not been installed or is abstract.
> > socialmediacourses.university: Reverse query name for m2m field
> > 'departments' clashes with field 'departments.university'. Add a
> > related_name argument to the definition for 'departments'.
>
> > what am I doing wrong?
>
> > On Nov 21, 4:23 am, Carlos Daniel Ruvalcaba Valenzuela
> >  wrote:
> >> Depends on you requirements, you could have used a Foreign Key to the
> >> University on the Department model and marking it as required, thus
> >> there cannot be a Department without university and set the
> >> related_name property on the ForeignKey to the "departments" so you
> >> can access University.departments property for the list of
> >> departments.
>
> >> You may not want this if you only want to have 1 kind of department
> >> which will be linked to many universities, but I see this may not be
> >> the case, thus your models may end like this:
>
> >> class departments(models.Model):
>
> >>         GENDER = ((u'M', u'Male'),(u'F', u'Female'),)
>
> >>         university = models.ForeignKey(university, 
> >> related_name="departments")
> >>         name = models.CharField(max_length=60)
> >>         head_name = models.CharField(max_length=60)
> >>         head_email = models.EmailField(max_length=60)
> >>         head_gender = models.CharField(max_length=2, choices=GENDER)
>
> >> Regards,
> >> Carlos Ruvalcaba
>
> >> On Sat, Nov 20, 2010 at 6:19 PM, Bruno Amaral  wrote:
> >> > I have been trying to create a database for Universities, Departments
> >> > and Courses.
>
> >> > The idea is that a University has many departments, which in turn have
> >> > one or more courses.
>
> >> > So far, this model works:http://dpaste.com/277850/
>
> >> > With one caveat, it allows a department to exist without a University
> >> > linked to it.
>
> >> > I am at a loss here, even after reading over all the documentation I
> >> > could find on the website, does anyone have an idea on what I am doing
> >> > wrong, or where I should look for a solution?
>
> >> > --
> >> > 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 
> >> > athttp://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 
> > athttp://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.



Use Django's url template tag with special characters

2010-11-21 Thread Ed
I'm using django's url tag to move from one view to another:

Read more here

For most "items" this works perfectly. But I have an "item" with a /
character: Sci-Fi/Fantasy. In this instance, I get an error

Caught NoReverseMatch while rendering: Reverse for 'wiki_view' with
arguments '(u'Sci-fi/Fantasy',)' and keyword arguments '{}' not found.

My urls.py is defined as such:

url(r'^wiki/page/(?P[^/]*)/$', views.wiki_view, name =
'wiki_view'),

Is there a way for this to work with a "/" character in place like
this?  I was advised to use urlencode.

Read more here

This gives the same error.  I believe the dev version allows me to use
this:

Read more here

as discussed here: 
http://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#urlencode

but I'm on 1.3.0 alpha and I may want to go into production with some
of this code.

-- 
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: Not main content on site - how to?

2010-11-21 Thread Kenneth Gonsalves
On Sun, 2010-11-21 at 03:54 -0800, robos85 wrote:
> I'm wondering how to make a sidebars on my site. Main content is not a
> problem - I use views to do that. What about the rest of site content?
> I want for example to have last comments, last posts, the most popular
> posts and the most rated. How to plan that. Which Django structures
> should I use? 

one way is templatetags
-- 
regards
Kenneth Gonsalves

-- 
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: Conf/locale

2010-11-21 Thread Kenneth Gonsalves
On Sun, 2010-11-21 at 19:46 +1100, Lachlan Musicman wrote:
> So if you just want to "see" you site in the other languages, to
> confirm that it's working, try loading another browser and setting
> it's locale to the language you are after. 

well ... there is setlang, which if activated will help you to set any
language you want as long as you add the language in settings.py. (The
idea of opening 35 varieties of browser to view all Indian
languages ...). Further if you *must* use different browsers, you can
set up different profiles for firefox.
-- 
regards
Kenneth Gonsalves

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



Serve different page to IE7/8?

2010-11-21 Thread Victor Hooi
Hi,

We're currently development a small Django webapp for use internally.

The page renders fine on Firefox and Webkit-based browsers.

However, many of our users are still on Internet Explorer 7, and the
CSS/HTML we're using seems to bork really badly on that. I'm
definitely not a web-designer by trade, and I'm not really not on top
of all the quirks of the different browser.

I know this is a bit of a hack, but what's the best way to serve up a
different template to those IE7 users? Hopefully it'll be less of an
issue when IE9 eventually rolls out (although I suspect it'll still be
an issue), but something like this would be a good stopgap for us, and
the site/templates itself it fairly simple.

What's the most Django-ish way of doing it?

We'd probably actually like something similar for our BlackBerry users
as well - same view code, but serving up a different template, based
on user-agent - recommended way?

Cheers,
Victor

-- 
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: Pydoc and security

2010-11-21 Thread Robert S
Thanks, I've just added the following line near the start of my
settings file ...

__all__ = ['INSTALLED_APPS']

... that looks much better

On Nov 21, 8:24 pm, Masklinn  wrote:
> On 2010-11-21, at 21:19 , Robert S wrote:
>
> > I'm not!
> > Pydoc is picking up any variables that are not hidden in classes of
> > functions.
>
> > Is there a command to (selectivly) stop this?
>
> PyDoc respects __all__.

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



django.contrib.sitemaps unit tests dependency on django.contrib.auth

2010-11-21 Thread Frank
It appears that at some where between development of 1.2.1 and 1.2.3,
django.contrib.sitemaps becomes dependent on django.contrib.auth for
unit tests.

Since not all Django apps will use the auth system, I'm curious if
that dependency should exist? I ask because I was going to file a
report in trac but didn't want to re-hash that if it is known and
accepted as appropriate.

Furthermore, the docs do not note the dependency:
http://docs.djangoproject.com/en/1.2/ref/contrib/sitemaps/

I suppose this might not be the best place for this type of thing but
thought I'd start here...

Regards,
Frank

-- 
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: restrict downloading files based on user-permission

2010-11-21 Thread Łukasz Rekucki
I'm guessing that your original problem was that HTTP headers can only
contain ASCII characters. To have a UTF-8 encoded name, you should use
percent-encoding. I'm using this code on production site:

quoted_name = urllib.quote(file.name.encode('utf-8'))
response['Content-Disposition'] = 'attachment; filename=%s' % quoted_name

and it works perfectly with any unicode name.

> On 21 Nov., 16:31, patrickk  wrote:
>> I need to serve media-files uploaded by users, but only the user who
>> uploaded a file should be able to download that file again. therefore,
>> I need to check whether the currently logged-in user is the creator of
>> that file (ok, that´s easy with using a view).
>>
>> – of course, serving the media-file via django is not an option.
>> – downloading the file (changing the response-header) is not an option
>> either since we need to use utf-8 filenames (same goes for xsendfile).
>>
>> any ideas on how to achieve this? btw, we´re using mod_wsgi.
>>
>> thanks,
>> patrick
>
> --
> 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.
>
>



-- 
Łukasz Rekucki

-- 
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: Pydoc and security

2010-11-21 Thread Masklinn
On 2010-11-21, at 21:19 , Robert S wrote:
> I'm not!
> Pydoc is picking up any variables that are not hidden in classes of
> functions.
> 
> Is there a command to (selectivly) stop this?

PyDoc respects __all__.

-- 
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: Pydoc and security

2010-11-21 Thread Robert S
I'm not!
Pydoc is picking up any variables that are not hidden in classes of
functions.

Is there a command to (selectivly) stop this?

On Nov 21, 11:35 am, Łukasz Rekucki  wrote:
> On 20 November 2010 23:31, Robert S  wrote:
>
> > Hi
> > I'm trying generate documentation for a django project.
>
> > The obvious tool is pydoc, which does work.  The trouble is, pydoc
> > publishes everything ... including passwords.
>
> Why would you put any passwords in docstrings ?
>
> --
> Łukasz Rekucki

-- 
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.contrib.sitemaps unit tests dependency on django.contrib.auth

2010-11-21 Thread Karen Tracey
On Sun, Nov 21, 2010 at 2:59 PM, Frank  wrote:

> It appears that at some where between development of 1.2.1 and 1.2.3,
> django.contrib.sitemaps becomes dependent on django.contrib.auth for
> unit tests.
>
> Since not all Django apps will use the auth system, I'm curious if
> that dependency should exist? I ask because I was going to file a
> report in trac but didn't want to re-hash that if it is known and
> accepted as appropriate.
>
> Furthermore, the docs do not note the dependency:
> http://docs.djangoproject.com/en/1.2/ref/contrib/sitemaps/
>
> I suppose this might not be the best place for this type of thing but
> thought I'd start here...
>
>
It's possible the problem you have found with 1.2.3 has already been fixed,
this search:

http://code.djangoproject.com/search?q=sitemaps+auth=1=on=on

shows some recent changes to the sitemaps tests to fix interdependency
problems.

If the problem you are seeing it not fixed in the current trunk (or 1.2.X
branch) level code then opening a ticket to report the problem would be a
good idea.

Karen
-- 
http://tracey.org/kmt/

-- 
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 UserProfile's - the hardest part of the whole framework

2010-11-21 Thread Rogério Carrasqueira
Hi,

I liked your example, but I'd like to do on a single funcion at my
view. On you example your steps are going to to work two functions: a
profile created (not described) and a profile_edit. So, my intention
is make everything on a one single function using the max powerful DRY
concept of Django. Can you help on this way?

Thanks

Rogério Carrasqueira

On 1 set, 03:09, bruno desthuilliers 
wrote:
> (snip 'programming by accident' code)
>
> I'm not sure you really understand what you're doing :-/
>
> > > > Here's my problem, I know you don't get direct access to theuser
> > > > model,
>
> > > Yes you do.
>
> > > > so making theuseremail editable is kind of tricky
>
> > > Why so ?
>
> > you can't query for auserwith request.user
>
> Query what ?
>
> > but I can with user_id as
> > above.
>
> Where exactly ?
>
> > > I personnaly don't use a ModelForm foruserprofiles - since you
> > > (usually) have to mix data from both theuserand profile
> > > models, I find it simpler to use a plain forms.Formand handle the
> > >fields/models mapping, saving etc by myself
>
> > Do you have an example, I keep piecing together stuff from the b-list
> > etc.
>
> Yeps, that's what your code looks like - copy/paste without true
> undrestanding...
>
> Here's a (shortened and simplified) snippet:
>
> class ProfileForm(forms.Form):
>     #Userfields
>     first_name = forms.CharField(
>         label=_("First name"),
>         max_length=30
>         )
>
>     last_name = forms.CharField(
>         label=_("Last name"),
>         max_length=30
>         )
>
>     email = forms.EmailField(
>         label=_("E-mail"),
>         max_length=128,
>         help_text=_(u"ex : pre...@exemple.com")
>         )
>
>     _USER_FIELDS = (
>         'first_name',
>         'last_name',
>         'email'
>         )
>
>     # Profilefields
>     address1 = forms.CharField(
>         label=_("Address 1"),
>         max_length=80
>         )
>
>     address2 = forms.CharField(
>         label=_("Address 2"),
>         max_length=80,
>         required=False
>         )
>
>     postcode = forms.CharField(
>         label=_("Postcode"),
>         max_length=10, # should be enough for most cases ? NB : max 8
> in current dataset
>         required=False    # no postcode for IR ???
>         )
>
>     town = forms.CharField(
>         label=_("Town"),
>         max_length=100
>         )
>
>     #
> --
>     def _from_model(self, name):
>         if name in self._USER_FIELDS:
>             return getattr(self.user, name)
>         else:
>             return getattr(self.profile, name)
>
>     #
> --
>     def _to_model(self, name, value):
>         if name in self._USER_FIELDS:
>             setattr(self.user, name, value)
>         else:
>             setattr(self.profile, name, value)
>
>     #
> --
>     def __init__(self, profile, *args, **kw):
>         self.prefix = kw.get("prefix", None)
>         data = kw.pop('data', {}).copy()
>
>         self.profile = profile
>         self.user=user= profile.user
>
>         for name in self.base_fields:
>             data.setdefault(self.add_prefix(name),
> self._from_model(name))
>
>         kw['data'] = data
>         super(ProfileForm, self).__init__(*args, **kw)
>
>     #
> --
>     def save(self):
>         if not self.is_valid():
>             raise ValueError("trying to save an invalidform")
>
>         # XXX : handle transaction here ?
>         self.user.save()
>         self.profile.save()
>
>         return self.profile, self.user
>
> #
> --
> #
> --
> @login_required
> @csrf_protect
> def profile_edit(request, *args, **kw):
>    user= request.user
>     profile =user.get_profile()
>
>     if request.method == "POST":
>         profile_form = ProfileForm(profile, data=request.POST)
>         if profile_form.is_valid():
>             profile_form.save()
>            user.message_set.create(message=_("Your profile has been
> modified successfully"))
>             return HttpResponseRedirect(reverse("core_profile_edit"))
>     else:
>         profile_form = ProfileForm(profile)
>
>     context = dict(
>         profile=profile,
>         profile_form=profile_form,
>         )
>
>     return render_to_response(
>         "core/profile_edit.html",
>         context,
>         context_instance=RequestContext(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-us...@googlegroups.com.
To unsubscribe from this group, send 

Re: Static files ...

2010-11-21 Thread Steve Holden
On 11/21/2010 10:52 AM, jonno wrote:
> I think I'm getting there, and thanks Steve! I've switched my
> directory structure around a bit, but I'm now able to make changes
> with predictable results.  Still no image, however, but I can't be too
> far off.  I'll return to the context processor thing as soon as I see
> an image.  I now have:
> 
> STATICFILES_ROOT = '/Users/jonno/django_projects/MCOt/static/'
> 
> My template calls:
> 
> 
> 
> and Chrome reports:
> 
> Request URL:http://localhost:8000/static/imgs/cellohome.jpg
> 
> This seems correct, but it's still a 404.  Thanks again --  Jon.

You say it "seems correct", but if it's a 404 have you actually set
Django or another web server to serve those files?

http://docs.djangoproject.com/en/dev/howto/static-files/

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.



Re: restrict downloading files based on user-permission

2010-11-21 Thread patrickk
well ... yes, but if someond uploads "äöü.PDF" I want the user to
download "äöü.PDF" again ... and not
%C3%83%C2%A4%C3%83%C2%B6%C3%83%C2%BC.PDF.

did you test your code with IE7/IE8? I just did and the name of the
downloaded file differs from the upload.

regards,
patrick

On 21 Nov., 20:39, Łukasz Rekucki  wrote:
> I'm guessing that your original problem was that HTTP headers can only
> contain ASCII characters. To have a UTF-8 encoded name, you should use
> percent-encoding. I'm using this code on production site:
>
> quoted_name = urllib.quote(file.name.encode('utf-8'))
> response['Content-Disposition'] = 'attachment; filename=%s' % quoted_name
>
> and it works perfectly with any unicode name.
>
>
>
> > On 21 Nov., 16:31, patrickk  wrote:
> >> I need to serve media-files uploaded by users, but only the user who
> >> uploaded a file should be able to download that file again. therefore,
> >> I need to check whether the currently logged-in user is the creator of
> >> that file (ok, that´s easy with using a view).
>
> >> - of course, serving the media-file via django is not an option.
> >> - downloading the file (changing the response-header) is not an option
> >> either since we need to use utf-8 filenames (same goes for xsendfile).
>
> >> any ideas on how to achieve this? btw, we´re using mod_wsgi.
>
> >> thanks,
> >> patrick
>
> > --
> > 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 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> Łukasz Rekucki

-- 
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: Multiple inheritance model

2010-11-21 Thread Joseph (Driftwood Cove Designs)
this is django.db.models.base.Model.save_base()

a comment in the code for ModelA indicates the call to save_base() is
required for Mptt.

On Nov 21, 5:43 am, Marc Aymerich  wrote:
> On Sun, Nov 21, 2010 at 5:31 AM, Joseph (Driftwood Cove Designs) <
>
> powderfl...@gmail.com> wrote:
> > Below is the basic layout - I posted a simplified version of the two
> > model classes here:http://pastebin.com/Xc3KLrQx
>
> > ModelA.save():
> >   if (some condition):
> >      super().save_base()
>
> Hi the problem could be on  save_base. Can you paste this method too ¿
>
> --
> Marc

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



'utf8' codec can't decode byte 0xe9 in position 303: invalid continuation byte

2010-11-21 Thread Alex s
Hi,

In homepage.html file, I am trying to write the letter "é". So I have the
following error:

'utf8' codec can't decode byte 0xe9 in position 303: invalid continuation byte

How can I resolve this ? I am trying to use brazilian language.

Thanks
Alex

-- 
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: Not main content on site - how to?

2010-11-21 Thread robos85
Thanks for all replies. I've read a bit about template tags. It looks
fine for me. Write one tag for each side plugin. Then prepare some
sets of these tags and call it whether set I want.
I hope my approach is good.

On 21 Lis, 19:40, "Joseph (Driftwood Cove Designs)"
 wrote:
> robos85 -
> there are a couple ways to go -
>  - context processor: this can add a set of context variables so they
> are available in every template
>      - very easy to write - just a function that takes a request
> object, returns a context dictionary.  Add to your CONTEXT_PROCESSORS
> setting
>        
> http://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-c...
>      - if it's a lot of stuff, your CP could be conditional based on
> which sub-site.
>  - template tags (as suggested above) - you'll need a different
> templates for each unique sub-site (or conditional logic in your
> template)
>       - write your own template tags (I often use Inclusion Tags for
> this kind of thing - they are so easy to 
> implement:http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#incl...)
>
> good luck.
> On Nov 21, 3:54 am, robos85  wrote:
>
>
>
>
>
>
>
> > I'm wondering how to make a sidebars on my site. Main content is not a
> > problem - I use views to do that. What about the rest of site content?
> > I want for example to have last comments, last posts, the most popular
> > posts and the most rated. How to plan that. Which Django structures
> > should I use?
> > Additionally I want to have different sets of that content of
> > different sub-sites.
>
> > Thanks for clue.

-- 
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 can I set a flatpage to be my homepage?

2010-11-21 Thread mongoose
Hi there,

I've created some flatpages and they work great. For example
http://127.0.0.1:8000/home/ and http://127.0.0.1:8000/blog/

I'm catching my flatpages with
urlpatterns += patterns('',
(r'', include('darren_web.flatpages.urls')),
)

What I want though is for http://127.0.0.1:8000/home/ to come up as
http://127.0.0.1:8000/
How can I do this?


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.



Re: How can I set a flatpage to be my homepage?

2010-11-21 Thread Joseph (Driftwood Cove Designs)
mongoose -
  all you need to do is specify the url:  /
  for the flatpage you want to be homepage.

  a flatpage can only have one URL - if you want it to show up on 2
urls (e.g. / and /home/), you'll need a re-direct, a view, a re-write
rule, or some other trick.

good luck.

On Nov 21, 2:48 am, mongoose  wrote:
> Hi there,
>
> I've created some flatpages and they work great. For 
> examplehttp://127.0.0.1:8000/home/andhttp://127.0.0.1:8000/blog/
>
> I'm catching my flatpages with
> urlpatterns += patterns('',
>     (r'', include('darren_web.flatpages.urls')),
> )
>
> What I want though is forhttp://127.0.0.1:8000/home/to come up 
> ashttp://127.0.0.1:8000/
> How can I do this?
>
> 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.



Re: Not main content on site - how to?

2010-11-21 Thread Joseph (Driftwood Cove Designs)
robos85 -
there are a couple ways to go -
 - context processor: this can add a set of context variables so they
are available in every template
 - very easy to write - just a function that takes a request
object, returns a context dictionary.  Add to your CONTEXT_PROCESSORS
setting
   
http://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-context-requestcontext
 - if it's a lot of stuff, your CP could be conditional based on
which sub-site.
 - template tags (as suggested above) - you'll need a different
templates for each unique sub-site (or conditional logic in your
template)
  - write your own template tags (I often use Inclusion Tags for
this kind of thing - they are so easy to implement:
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags)

good luck.
On Nov 21, 3:54 am, robos85  wrote:
> I'm wondering how to make a sidebars on my site. Main content is not a
> problem - I use views to do that. What about the rest of site content?
> I want for example to have last comments, last posts, the most popular
> posts and the most rated. How to plan that. Which Django structures
> should I use?
> Additionally I want to have different sets of that content of
> different sub-sites.
>
> Thanks for clue.

-- 
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: How can I set a flatpage to be my homepage?

2010-11-21 Thread vikalp sahni
Hi,

If i understood ur question properly

you need a URL rewrite. you can try either

Apache Rewrite (1st Preference) or
you can also import a django app "django.contrib.redirects"

which will help u in redirecting URL's

Regards
//Vikalp



On Sun, Nov 21, 2010 at 4:18 PM, mongoose  wrote:

> Hi there,
>
> I've created some flatpages and they work great. For example
> http://127.0.0.1:8000/home/ and http://127.0.0.1:8000/blog/
>
> I'm catching my flatpages with
> urlpatterns += patterns('',
>(r'', include('darren_web.flatpages.urls')),
> )
>
> What I want though is for http://127.0.0.1:8000/home/ to come up as
> http://127.0.0.1:8000/
> How can I do this?
>
>
> 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.
>
>

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



restrict downloading files based on user-permission

2010-11-21 Thread patrickk
I need to serve media-files uploaded by users, but only the user who
uploaded a file should be able to download that file again. therefore,
I need to check whether the currently logged-in user is the creator of
that file (ok, that´s easy with using a view).

– of course, serving the media-file via django is not an option.
– downloading the file (changing the response-header) is not an option
either since we need to use utf-8 filenames (same goes for xsendfile).

any ideas on how to achieve this? btw, we´re using mod_wsgi.

thanks,
patrick

-- 
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: Askani

2010-11-21 Thread Joseph (Driftwood Cove Designs)
Hey Alvaro -
I only meant that this tool might allow non-programmers (web
designers, maybe even clients) to collaborate in the model proto-
typing.  Currently must use diagramming tools that don't generate
Django code (mostly these tools want to generate the SQL directly) -
would be great to have a diagramming tool that generates the django
models.

Stick with Django/Python - there are lots of tools out there for
modelling in other languages (eg. Eclipse EMF, GEF, etc.)

One thing that does occur - you might want to look at some of the open-
source data modelling tools out there - there might be one that you
can adapt to generate django models instead of SQL models - could save
you a ton of design and UI work if you find the right one.

ciao.
...Joseph

On Nov 21, 5:35 am, Alvaro Mouriño  wrote:
> 2010/11/21 Joseph (Driftwood Cove Designs) :
>
> > Alvaro -
> > this is a nifty idea - will save time and improve consistency.
>
> > Opens up model proto-typing to non-Django, non-Python, maybe even non-
> > programmer?  Could be used for collaboration during model design -
> > especially if it presents an ER'ish diagram as you build the data
> > model.
>
> > look forward to seeing this progress - nice work.
>
> Hi Joseph.
>
> I thought about generating not-only-python, but it was easier for me
> to get it up and running concentrating just on django. It's on my
> mind, yes, but it's not easy. The first option was obviously rails,
> but I never coded a line of ruby, so I'm going to need help with that.
>
> Regarding collaboration, one of the goals is to allow concurrent
> edition of a project, with a sort-of-chat-room on the side so the
> users can communicate. Always trying to avoid the need of a web server
> as much as possible.
>
> Thanks for taking the time to try it.
>
> --
> Alvaro Mouriñohttp://askani.net/

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



Current Django 1.3 Alpha 2 Documentation as PDF

2010-11-21 Thread ckar...@googlemail.com
Are you interested in the current Django 1.3 Alpha 2 documentation as
PDF?

-- 
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: Current Django 1.3 Alpha 2 Documentation as PDF

2010-11-21 Thread ckar...@googlemail.com
Sry for dublepost.

For those who don't want to install all the *tex* libraries. Here is
the link: http://ubuntuone.com/p/QFl/

Have fun with printing and reading ;-)

On 21 Nov., 18:00, "ckar...@googlemail.com" 
wrote:
> Are you interested in the current Django 1.3 Alpha 2 documentation as
> PDF?

-- 
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: restrict downloading files based on user-permission

2010-11-21 Thread patrickk
just for the records ...

it seems to work when filename is not defined with
response["Content-Disposition"] = "attachment; filename=äöü &%%%.pdf"
instead just use
response["Content-Disposition"] = "attachment"
and add the filename to the URL, e.g.
/user/downloads/15/äöü &.pdf
where
15 is the object-id and the filename has to be urlencoded.

within a template, it looks like this:
{% url attachment_download object.id %}{{ object.attachment.name|
urlencode }}

the view just checks if the attachment with id 15 has been uploaded by
the logged-in user and returns the attachment:

def attachment_download(request, object_id):
import mimetypes
obj = get_object_or_404(UserAttachment, user=request.user,
pk=object_id)
mimetype, encoding = mimetypes.guess_type(fullpath)
mimetype = mimetype or 'application/octet-stream'
response = HttpResponse(obj.attachment.read(), mimetype=mimetype)
response['Content-Length'] = obj.attachment.size
response["Content-Disposition"] = "attachment"
if encoding:
response["Content-Encoding"] = encoding
return response

tested with firefox, safari, chrome, IE7, IE8, opera ... guess it
works.

regards,
patrick


On 21 Nov., 16:31, patrickk  wrote:
> I need to serve media-files uploaded by users, but only the user who
> uploaded a file should be able to download that file again. therefore,
> I need to check whether the currently logged-in user is the creator of
> that file (ok, that´s easy with using a view).
>
> – of course, serving the media-file via django is not an option.
> – downloading the file (changing the response-header) is not an option
> either since we need to use utf-8 filenames (same goes for xsendfile).
>
> any ideas on how to achieve this? btw, we´re using mod_wsgi.
>
> thanks,
> patrick

-- 
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: User model optional

2010-11-21 Thread Scot Hacker
On Nov 20, 2:55 pm, VB  wrote:

> If I intend to write my own authentication, can I use my define my own
> User model? Or, am I better off naming the model something else?
>

Why write your own authentication? That wheel's been invented so
excellently by  django-registration (and its equally indispensable
cousin django-profiles). I'd recommend sticking with the Django User
object, and doing your auth with django-registration - they're
fundamentals of most Django projects.

./s

-- 
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: Not main content on site - how to?

2010-11-21 Thread Daniel Roseman
On Nov 21, 11:54 am, robos85  wrote:
> I'm wondering how to make a sidebars on my site. Main content is not a
> problem - I use views to do that. What about the rest of site content?
> I want for example to have last comments, last posts, the most popular
> posts and the most rated. How to plan that. Which Django structures
> should I use?
> Additionally I want to have different sets of that content of
> different sub-sites.
>
> Thanks for clue.

Template tags are what you need.
--
DR.

-- 
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: database relationships, many to one

2010-11-21 Thread Carlos Daniel Ruvalcaba Valenzuela
The first error is simple, university models is defined after your
department model, thus is not found, you can define the foreign key as
a string in the form of "appname.ModelName", so you will define it
like this:

class departments(models.Model):
university = models.ForeignKey("appname.university",
related_name="departments")

Where appname is the name of the application where the models are
being defined (the folder where models.py is stored).

About the other problem, it would be good to have a little more
context on what is socialmediacourses and where is throwing you the
error, but with the above change should do the trick, just don't
forget to remove your ManyToMany departments definition on University
model, that would make the name university.department clash.

Regards,
Carlos Ruvalcaba

On Sun, Nov 21, 2010 at 7:10 AM, Bruno Amaral  wrote:
> Carlos, Thank you for this!
>
> Your solution is what I am looking for,but for some reason I get an
> error message:
> "NameError: name 'university' is not defined"  278024/>
>
> Figuring this could an issue with Python and not Django, i added
> university ='' to the top.
>
> The validate command returned the message:
> Error: One or more models did not validate:
> socialmediacourses.departments: 'university' has a relation with
> model , which has either not been installed or is abstract.
> socialmediacourses.university: Reverse query name for m2m field
> 'departments' clashes with field 'departments.university'. Add a
> related_name argument to the definition for 'departments'.
>
> what am I doing wrong?
>
> On Nov 21, 4:23 am, Carlos Daniel Ruvalcaba Valenzuela
>  wrote:
>> Depends on you requirements, you could have used a Foreign Key to the
>> University on the Department model and marking it as required, thus
>> there cannot be a Department without university and set the
>> related_name property on the ForeignKey to the "departments" so you
>> can access University.departments property for the list of
>> departments.
>>
>> You may not want this if you only want to have 1 kind of department
>> which will be linked to many universities, but I see this may not be
>> the case, thus your models may end like this:
>>
>> class departments(models.Model):
>>
>>         GENDER = ((u'M', u'Male'),(u'F', u'Female'),)
>>
>>         university = models.ForeignKey(university, 
>> related_name="departments")
>>         name = models.CharField(max_length=60)
>>         head_name = models.CharField(max_length=60)
>>         head_email = models.EmailField(max_length=60)
>>         head_gender = models.CharField(max_length=2, choices=GENDER)
>>
>> Regards,
>> Carlos Ruvalcaba
>>
>>
>>
>> On Sat, Nov 20, 2010 at 6:19 PM, Bruno Amaral  wrote:
>> > I have been trying to create a database for Universities, Departments
>> > and Courses.
>>
>> > The idea is that a University has many departments, which in turn have
>> > one or more courses.
>>
>> > So far, this model works:http://dpaste.com/277850/
>>
>> > With one caveat, it allows a department to exist without a University
>> > linked to it.
>>
>> > I am at a loss here, even after reading over all the documentation I
>> > could find on the website, does anyone have an idea on what I am doing
>> > wrong, or where I should look for a solution?
>>
>> > --
>> > 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 
>> > athttp://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: Static files ...

2010-11-21 Thread jonno
I think I'm getting there, and thanks Steve! I've switched my
directory structure around a bit, but I'm now able to make changes
with predictable results.  Still no image, however, but I can't be too
far off.  I'll return to the context processor thing as soon as I see
an image.  I now have:

STATICFILES_ROOT = '/Users/jonno/django_projects/MCOt/static/'

My template calls:



and Chrome reports:

Request URL:http://localhost:8000/static/imgs/cellohome.jpg

This seems correct, but it's still a 404.  Thanks again --  Jon.

-- 
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: database relationships, many to one

2010-11-21 Thread Bruno Amaral
Carlos, Thank you for this!

Your solution is what I am looking for,but for some reason I get an
error message:
"NameError: name 'university' is not defined" 

Figuring this could an issue with Python and not Django, i added
university ='' to the top.

The validate command returned the message:
Error: One or more models did not validate:
socialmediacourses.departments: 'university' has a relation with
model , which has either not been installed or is abstract.
socialmediacourses.university: Reverse query name for m2m field
'departments' clashes with field 'departments.university'. Add a
related_name argument to the definition for 'departments'.

what am I doing wrong?

On Nov 21, 4:23 am, Carlos Daniel Ruvalcaba Valenzuela
 wrote:
> Depends on you requirements, you could have used a Foreign Key to the
> University on the Department model and marking it as required, thus
> there cannot be a Department without university and set the
> related_name property on the ForeignKey to the "departments" so you
> can access University.departments property for the list of
> departments.
>
> You may not want this if you only want to have 1 kind of department
> which will be linked to many universities, but I see this may not be
> the case, thus your models may end like this:
>
> class departments(models.Model):
>
>         GENDER = ((u'M', u'Male'),(u'F', u'Female'),)
>
>         university = models.ForeignKey(university, related_name="departments")
>         name = models.CharField(max_length=60)
>         head_name = models.CharField(max_length=60)
>         head_email = models.EmailField(max_length=60)
>         head_gender = models.CharField(max_length=2, choices=GENDER)
>
> Regards,
> Carlos Ruvalcaba
>
>
>
> On Sat, Nov 20, 2010 at 6:19 PM, Bruno Amaral  wrote:
> > I have been trying to create a database for Universities, Departments
> > and Courses.
>
> > The idea is that a University has many departments, which in turn have
> > one or more courses.
>
> > So far, this model works:http://dpaste.com/277850/
>
> > With one caveat, it allows a department to exist without a University
> > linked to it.
>
> > I am at a loss here, even after reading over all the documentation I
> > could find on the website, does anyone have an idea on what I am doing
> > wrong, or where I should look for a solution?
>
> > --
> > 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 
> > athttp://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: Multiple inheritance model

2010-11-21 Thread Marc Aymerich
On Sun, Nov 21, 2010 at 5:31 AM, Joseph (Driftwood Cove Designs) <
powderfl...@gmail.com> wrote:

> Below is the basic layout - I posted a simplified version of the two
> model classes here: http://pastebin.com/Xc3KLrQx
>
> ModelA.save():
>   if (some condition):
>  super().save_base()
>

Hi the problem could be on  save_base. Can you paste this method too ¿

-- 
Marc

-- 
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: Askani

2010-11-21 Thread Alvaro Mouriño
2010/11/21 Joseph (Driftwood Cove Designs) :
> Alvaro -
> this is a nifty idea - will save time and improve consistency.
>
> Opens up model proto-typing to non-Django, non-Python, maybe even non-
> programmer?  Could be used for collaboration during model design -
> especially if it presents an ER'ish diagram as you build the data
> model.
>
> look forward to seeing this progress - nice work.

Hi Joseph.

I thought about generating not-only-python, but it was easier for me
to get it up and running concentrating just on django. It's on my
mind, yes, but it's not easy. The first option was obviously rails,
but I never coded a line of ruby, so I'm going to need help with that.

Regarding collaboration, one of the goals is to allow concurrent
edition of a project, with a sort-of-chat-room on the side so the
users can communicate. Always trying to avoid the need of a web server
as much as possible.

Thanks for taking the time to try it.

-- 
Alvaro Mouriño
http://askani.net/

-- 
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: Not main content on site - how to?

2010-11-21 Thread Jonas Geiregat
Inside your views.py file you define functions where you render the template 
and do your queries.

For example:


def last_post(req):
# Get some results out of your database
post = Post.objects.order_by('-pub_date')[0]
# render the results
return render_to_response('blog/last_post.html', {"post", post})

Now you need to edit your urls.py file and add something like:

(r'^blog/last_post/$', 'yoursite.blog.last_post.'),

Now if you visit http://yourhost.com/blog/last_post it should render the latest 
post. Of course you still need to define a template file (last_post.html) to 
make this work.

yoursite is the name of the django project and blog is a django application.

Good luck!


Op 21-nov-2010, om 12:54 heeft robos85 het volgende geschreven:

> I'm wondering how to make a sidebars on my site. Main content is not a
> problem - I use views to do that. What about the rest of site content?
> I want for example to have last comments, last posts, the most popular
> posts and the most rated. How to plan that. Which Django structures
> should I use?
> Additionally I want to have different sets of that content of
> different sub-sites.
> 
> Thanks for clue.
> 
> -- 
> 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.
> 

Met vriendelijke groeten,

Jonas Geiregat
jo...@geiregat.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-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.



Not main content on site - how to?

2010-11-21 Thread robos85
I'm wondering how to make a sidebars on my site. Main content is not a
problem - I use views to do that. What about the rest of site content?
I want for example to have last comments, last posts, the most popular
posts and the most rated. How to plan that. Which Django structures
should I use?
Additionally I want to have different sets of that content of
different sub-sites.

Thanks for clue.

-- 
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: Pydoc and security

2010-11-21 Thread Łukasz Rekucki
On 20 November 2010 23:31, Robert S  wrote:
> Hi
> I'm trying generate documentation for a django project.
>
> The obvious tool is pydoc, which does work.  The trouble is, pydoc
> publishes everything ... including passwords.

Why would you put any passwords in docstrings ?

-- 
Łukasz Rekucki

-- 
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: problems with model inheritance if base class is not abstract

2010-11-21 Thread Marco Ferragina
Mmm yes it seems you are right. But I think this is a bit confusing
thinking about object oriented programming, it is not? Then the only
way to avoid this seems to be use an abstract base class or use some
not so clean way to simulate this behavior.



On 21 Nov, 01:36, Ramiro Morales  wrote:
> On Sat, Nov 20, 2010 at 7:59 AM, marco.ferrag...@gmail.com
>
>
>
>
>
>
>
>
>
>  wrote:
> > Hi all! I'm new to django and I'm experimenting with models but I have
> > some trouble. I've minimized my problem to this code:
>
> > class TestBase(models.Model):
> >    base = models.CharField(max_length=255)
>
> > from django.contrib import admin
> > class TestA(TestBase):
> >    testb = models.CharField(max_length=255)
>
> > admin.site.register(TestA)
>
> > class TestB(TestBase):
> >    testc = models.CharField(max_length=255)
>
> > admin.site.register(TestB)
>
> > Trying to add TestA instances from admin interface I have this error:
> > Cannot assign "''": "TestA.testb" must be a "TestB" instance.
>
> > why testb should be a TestB instance?? It's a simple field!
>
> I suspect this is because of something that is described in the MTI docs:
>
> http://docs.djangoproject.com/en/1.2/topics/db/models/#multi-table-in...
>
> Translated to you example the relevant paragraph says:
>
> "If you have a TestBase that is also a TestB, you can get from the TestBase
> object to the TestB object by using the lower-case version of the model name:
>
> >>> p = TestBase.objects.get(id=12)
>
> # If p is a TestB object, this will give the child class:>>> p.testb
>
> 
>
> "
>
> The TestA model is inheriting that 'testb' accesor from TestBase to TestB
> and it is clashing with the identically named field.
>
> --
> Ramiro Morales

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

2010-11-21 Thread rattanpriya bhasin
thank you so much.it was quite helpful.

On Sat, Nov 20, 2010 at 6:40 PM, Darrel Herbst  wrote:

> I haven't used this, but this provides a way to interface with google
> charts:
> https://github.com/jacobian/django-googlecharts/blob/master/docs/examples.txt
>
> On Nov 19, 1:56 am, Priya  wrote:
> > Hi,
> > I am a new user to django ,can anybody please help me resolve this
> > issue.I am trying to construct a Gant chart based on the certain
> > constraints.Now i am unable to make a line of approach for this.I have
> > defined a class for chart and defined function for it in views.Now how
> > do i pass my values to the gant chart .
> > So the idea is..i have n number of task who have deadlines.So i want
> > to show thiese tasks thru a gant chart and then want to show a pie
> > chart giving the perfomance eg. 4% work done til so and so date.
> > Can anybody help me with the coding of all these.
>
> --
> 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: Conf/locale

2010-11-21 Thread Lachlan Musicman
On Sat, Nov 20, 2010 at 23:29, Tsolmon Narantsogt  wrote:
> Hello fellows.
> I'm using Django 1.1 version. My goals is create multiple language site.
> I make po file
> myprojectname/conf/locale/mn/LC_MESSAGES/django.po
> and some msgid, msgstr.
> But it's don't work.

It's too late in the day to grok the below (and I'm just not good
enough at Django), but I found that you don't need to let users decide
which language that they want to use.

When I'm doing mulitlingual and want to see the results, I use a
different browser: I open firefox, set _firefox_'s default language to
(in my case) Japanese, and then view my site: booyah! there it is in
Japanese. If I surf the web in firefox, everything is in Japanese that
can be, so I need to do my English development in Chromium (or Opera,
IE, etc).

So if you just want to "see" you site in the other languages, to
confirm that it's working, try loading another browser and setting
it's locale to the language you are after.

I hope this helps (or gets me a good talking down because I've done it
wrong :) )
cheers
L.


>
> My index.html
>                {% load i18n %}
> {% get_current_language as LANGUAGE_CODE %}
> {% get_available_languages as LANGUAGES %}
> {% get_current_language_bidi as LANGUAGE_BIDI %}
> 
> 
> 
> {% for lang in LANGUAGES %}
>  {% ifequal request.LANGUAGE_CODE lang.0 %}
> selected
> {% endifequal %}>
> {{ lang.1 }}
> {% endfor %}
> 
> 
> 
> 
>          {% trans "current language" %}: {{ request.LANGUAGE_CODE }}
> My urls.py
>     (r'^i18n/', include('django.conf.urls.i18n')),
> Thanks.
> Tsolmon

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