Re: Import error No module named urls to url login_in in html page

2011-04-19 Thread Subhranath Chunder
Hi,

The problems seems to be with the way you are using the view prefixes in the
'patterns' function in your urls.py
Refer to:
http://docs.djangoproject.com/en/dev/topics/http/urls/#the-view-prefix

You have used 'view' string twice.

Thanks,
Subhranath Chunder.

On Tue, Apr 19, 2011 at 5:11 AM, Guevara  wrote:

> Hello!!
>
> I am getting the following error on my index.html page:
>
> Exception Type: TemplateSyntaxError
> Exception Value:
>
> Caught ImportError while rendering: No module named urls
>
>
> In this line:
>
>Login
>
> My urls.py:
>
> (r'^imobiliaria/', include('auth.urls')),
>
> In my auth app, i have this:
>
> urlpatterns = patterns('auth.views',
>url(r'^$', views.index, name="index"), <-- this is index page
>url(r'^accounts/login/$', views.login_in, name="login_in"), <--
> this is login page
>url(r'^logout/$', views.logout_view, name="logout_view"),
>url(r'^register/$',  views.register,  name="register"),
>url(r'^home/$', views.home, name="home"),
> )
>
>
> My view to render index.html is:
>
> def index(request):
>return render_to_response('imobiliaria/auth/index.html')
>
>
> In my settings.py i have this:
>
> AUTH_PROFILE_MODULE = 'imobiliaria.imobiliaria'
> LOGIN_URL = '/imobiliaria/accounts/login/'
>
> INSTALLED_APPS = (
> 'imobiliaria.auth',
> )
>
> ROOT_URLCONF = 'imobiliaria.urls'
>
>
>
> Anyone know where the problem might be?
> Thanks!!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: limit_choices_to (or some other way) to filter ForeignKey choices based on current model field

2011-04-19 Thread Derek
On Apr 16, 7:29 pm, Aljoša Mohorović 
wrote:
> if i have something like this:
> ===
> class MyModel(models.Model):
>     name  = models.CharField(max_length=255)
>
> class OtherModel(models.Model):
>     name  = models.CharField(max_length=255)
>     mymodel = models.ForeignKey(MyModel)
>
> class MyModelItem(models.Model):
>     mymodel = models.ForeignKey(MyModel)
>     other = models.ForeignKey(OtherModel, null=True, blank=True)
> ===
>
> how can i use limit_choices_to (or some other way) to filter
> ForeignKey choices based on current model field?
> basically, how can i do:
>     other = models.ForeignKey(OtherModel, null=True, blank=True,
> limit_choices_to={'mymodel': 'self.mymodel'})
>
> any options works for me (overwriting admin.TabularInline or form for
> TabularInline).
> thanks for any info.

Have a look at:
http://stackoverflow.com/questions/1387431/django-model-modelform-how-to-get-dynamic-choices-in-choicefield
or
http://stackoverflow.com/questions/3419997/creating-a-dynamic-choice-field

If you want to change a live form where items in combobox B depend on
an item selected in combobox A, then you will need to use custom
javascript (and there are a ton of examples on the web using, for
example, jQuery).

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



db routing by request

2011-04-19 Thread Michael P. Soulier
Hi,

I noticed that the request object is not passed to the database router, the
intention seems to mainly be to route by model. I have a case where I want to
route based on session data in the request. While I know that I can
explicitely use the using() method, this will be a tad labourious. Will it be
possible in the future to pass the request object to the database router?

Thanks,
Mike
-- 
Michael P. Soulier 
"Any intelligent fool can make things bigger and more complex... It takes a
touch of genius - and a lot of courage to move in the opposite direction."
--Albert Einstein


signature.asc
Description: Digital signature


Re: Form containing a Mutipolygon field for Django 1.3

2011-04-19 Thread GARRAM karim
I think a possible solution is to use :
http://django-floppyforms.readthedocs.org/en/latest/geodjango.html

the solution given in
http://stackoverflow.com/questions/559431/how-to-display-data-using-openlayers-with-openstreetmap-in-geodjango
didn't work for me
there was a problem with this instruction
PolygonFormField=GeneratePolygon._meta.get_field('Polygon')
it didn't found the GeneratePolygon object



On Apr 18, 3:13 pm, GARRAM karim  wrote:
> I am using dream weaver so when I deleted the heading
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> http://www.w3.org/1999/xhtml";>
> the problem of plotting the openlayer map was resolved
> Now my problem is still the mapping between the data to plot in the
> map and the multipolygon field, in my object definition
>
> On Apr 18, 1:12 pm, GARRAM karim  wrote:
>
>
>
>
>
>
>
> > I am working on a GeoDjango project. I have a model.py wich extend the
> > user model and contains a MultiPolygonField
>
> > class Membre(models.Model):
> >     user = models.ForeignKey(User, unique=True)
>
> >     #some other attributes
>
> >     mpoly = models.MultiPolygonField()
> >     objects = models.GeoManager()
>
> > class MembreForm(ModelForm):
> >     class Meta:
> >         model = Membre
> >         exclude = ('user',)
>
> > The form for this model works fine in the admin site. I am now
> > building the front office for it.
> > The problem that I'am facing is that in the resulting form I get a
> > mpoly (the mutipolygonfield) as a text area, I am facing the same
> > problem as:
>
> >http://stackoverflow.com/questions/559431/how-to-display-data-using-o...
>
> > I tryed to use OpenLayer script in my template to simply plot a
> > OpenLayer map but it didn't work (it worked for simple html pages). Is
> > there a GeoDjango specific tag to do that?
>
> > I think there is maybe a way to do this by using the (GeoDjango Admin
> > widget) but how to do it?
>
> > How can I use google map api for this field in both admin site and the
> > template I'm working on?

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



admin login fails

2011-04-19 Thread pfc
I'm new to Django and am following the tutorials, specifically:
http://docs.djangoproject.com/en/dev/intro/tutorial02/
I followed the instructions on adding admin to the INSTALLED_APPS, I
also added it to the urls, did syncdb and created the superuser.  When
trying to login with the superuser(username test, password test) I
then get the message "Please enter a correct username and password.
Note that both fields are case-sensitive."
I decided to create a second superuser and restarted the test server,
and still have the same issue.

A few days ago I had no problems getting this to work, but now even
when trying to create a new project I still get the same error.
Any ideas as to what I'm missing or what might be happening?

Thanks in advance for any help :-)

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



RE: Please Help a django Beginner!

2011-04-19 Thread Sells, Fred
I received this helpful hint from Shawn M. when faced with the same issue:
import os

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'  #whereever your 
settings.py is located.


>From the docs:
http://docs.djangoproject.com/en/dev/topics/settings/



-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Aviv Giladi
Sent: Friday, April 15, 2011 2:41 PM
To: Django users
Subject: Re: Please Help a django Beginner!

Thank you for the response. Is there any documentation / books out
there that you would recommend reading to get acquainted with django
in that perspective?

On Apr 15, 10:58 am, Jirka Vejrazka  wrote:
> I use Djano ORM for a lot of my backend processing where no web is
> involved. Just make sure that DJANGO_SETTINGS_MODULE is defined in
> your environment and you can use pretty much any part of Django in
> your own code/scrits/whatever.
>
>   HTH
>
>     Jirka
>
> On 15/04/2011, Aviv Giladi  wrote:
>
>
>
> > Hey guys,
>
> > I am an experienced Python developer starting to work on web service
> > backend system. The system feeds data (constantly) from the web to a
> > MySQL database. This data is later displayed by a frontend side (there
> > is no connection between the frontend and the backend). The backend
> > system constantly downloads flight information from the web (some of
> > the data is fetched via APIs, and some by downloading and parsing
> > text / xls files). I already have a script that downloads the data,
> > parses it, and inserts it to the MySQL db - all in a big loop. The
> > frontend side is just a bunch of php pages that properly display the
> > data by querying the MySQL server.
>
> > It is crucial that this web service be robust, strong and reliable.
> > Therefore, I have been looking into the proper ways to design it, and
> > got the following recommendation:
> > django as the framework (over Apache).
> > wrapping my sources with Piston for API usage.
> > All if this sounds great. I used django before to write websites (aka
> > request handlers that return data). However I don't see how django can
> > fulfill a role of a constant running (non request-serving) system -
> > being that it uses views/forms, which are not a part of my backend
> > system. Is want I want at all possible / advisable with django? Is
> > django what you would recommend for this?
> > If so, could you please refer me to some documentation / help files
> > more specific to my needs?
>
> > Thank you so much,
> > Aviv
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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


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



Re: Stackoverflow kind of Answer/commenting app in Django

2011-04-19 Thread Kundan Kumar
The app which i customized is Django 
voice. http://code.google.com/p/django-voice/ is quite easy to plug.

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



Looking for some help/guidance on how to create a facebook application based on django

2011-04-19 Thread mongoose
Hi all,

I've created the example django poll application on
http://docs.djangoproject.com/en/dev/intro/tutorial01/ Everything
works great.
I now want to have this poll application be a facebook application. I
thought by creating a FB application and just pointing to my hosted
Poll application URL
that everything should load fine, but alas it doesn't work. I get a "
CSRF token missing or incorrect" error which must be because the page
is POSTing and not doing a GET. But for a facebook application novice
like myself I don't know how to go about connecting these two
frameworks to make what should be a simple task manageable.

In short what I've done.
I've created the Poll sample app and have it hosted.
I've created a facebook applciation so I have my secret key, app id
and api key.
I've added my poll url into the "Facebook Integration" setting options
side of my facebook app.( which errors cause of the CSRF )

In short what I want.
I want people to have to add the application in facebook, allow it
permissions and be logged in in order to vote on polls.
If possible have this be a web application as well as a facebook
application.
People online or in FB should be able to see polls, but can only vote
if authenticated.

Can someone please guide me in the right direction. Some really simple
how to guides, advice or clear up to date documentation.

-
I did find this.
django-facebook https://github.com/tschellenbach/Django-facebook which
I think is a step in the right direction because I had tried so many
facebook django SDKs which all seemed to be outdated, causing many
hours of frustration. The app comes with it's own example project
which I've gotten to work. But again now that I want to create my own
app I'm a bit stumped.

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



Re: admin login fails

2011-04-19 Thread Joel Goldstick
On Tue, Apr 19, 2011 at 5:31 AM, pfc  wrote:

> I'm new to Django and am following the tutorials, specifically:
> http://docs.djangoproject.com/en/dev/intro/tutorial02/
> I followed the instructions on adding admin to the INSTALLED_APPS, I
> also added it to the urls, did syncdb and created the superuser.  When
> trying to login with the superuser(username test, password test) I
> then get the message "Please enter a correct username and password.
> Note that both fields are case-sensitive."
> I decided to create a second superuser and restarted the test server,
> and still have the same issue.
>
> A few days ago I had no problems getting this to work, but now even
> when trying to create a new project I still get the same error.
> Any ideas as to what I'm missing or what might be happening?
>
> Thanks in advance for any help :-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
Have you checked your caps-lock setting on your keyboard?


-- 
Joel Goldstick

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



Re: For any dictionary in a list, does a value exist for a key?

2011-04-19 Thread Chris Roat
Yep - trying to do it in a template.

I can just do the logic within in python - it'll mean redundant info going
into the template, but that's OK.

Thanks for your response,
C


On Mon, Apr 18, 2011 at 9:27 AM, Shawn Milochik  wrote:

> You can do this pretty easily in Python with any():
>
> if any(['foo' in x for x in my_list]):
>#do something
>
> However, I don't know of a way to do it in a template, which is what
> it appears you're asking.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: p.save not working in tutorial

2011-04-19 Thread xpdx
DOH!

I'll try that.

Thanks!

On Apr 17, 2:12 pm, Karen Tracey  wrote:
> On Sun, Apr 17, 2011 at 5:06 PM, xpdx  wrote:
>
> > >>> p
> > 
> > >>> p.save
> > >
> > >>> Poll.objects.all()
> > []
>
> p.save just shows you that p has an attribute named save, and what it is.
> You need parentheses after the save to actually call the method:
>
> >>> p.save()
>
> 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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Import error No module named urls to url login_in in html page

2011-04-19 Thread Guevara
Thank you Subhranath!

I do not know what happened, but I created a new project and put the
same configuration and is now working. I think it was a problem with
the framework.

I made the correction on this line:

AUTH_PROFILE_MODULE = 'imobiliaria.login'  <-- login app

Thanks!



On 19 abr, 06:49, Subhranath Chunder  wrote:
> Hi,
>
> The problems seems to be with the way you are using the view prefixes in the
> 'patterns' function in your urls.py
> Refer 
> to:http://docs.djangoproject.com/en/dev/topics/http/urls/#the-view-prefix
>
> You have used 'view' string twice.
>
> Thanks,
> Subhranath Chunder.
>
>
>
>
>
>
>
> On Tue, Apr 19, 2011 at 5:11 AM, Guevara  wrote:
> > Hello!!
>
> > I am getting the following error on my index.html page:
>
> > Exception Type:         TemplateSyntaxError
> > Exception Value:
>
> > Caught ImportError while rendering: No module named urls
>
> > In this line:
>
> >        Login
>
> > My urls.py:
>
> > (r'^imobiliaria/', include('auth.urls')),
>
> > In my auth app, i have this:
>
> > urlpatterns = patterns('auth.views',
> >    url(r'^$', views.index, name="index"), <-- this is index page
> >    url(r'^accounts/login/$', views.login_in, name="login_in"), <--
> > this is login page
> >    url(r'^logout/$', views.logout_view, name="logout_view"),
> >    url(r'^register/$',  views.register,  name="register"),
> >    url(r'^home/$', views.home, name="home"),
> > )
>
> > My view to render index.html is:
>
> > def index(request):
> >    return render_to_response('imobiliaria/auth/index.html')
>
> > In my settings.py i have this:
>
> > AUTH_PROFILE_MODULE = 'imobiliaria.imobiliaria'
> > LOGIN_URL = '/imobiliaria/accounts/login/'
>
> > INSTALLED_APPS = (
> > 'imobiliaria.auth',
> > )
>
> > ROOT_URLCONF = 'imobiliaria.urls'
>
> > Anyone know where the problem might be?
> > Thanks!!
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: admin login fails

2011-04-19 Thread Ernesto Guevara
Or you can delete database and execute again syncdb. The aplication ask
again the password, warning for capslock. =)

2011/4/19 pfc 

> I'm new to Django and am following the tutorials, specifically:
> http://docs.djangoproject.com/en/dev/intro/tutorial02/
> I followed the instructions on adding admin to the INSTALLED_APPS, I
> also added it to the urls, did syncdb and created the superuser.  When
> trying to login with the superuser(username test, password test) I
> then get the message "Please enter a correct username and password.
> Note that both fields are case-sensitive."
> I decided to create a second superuser and restarted the test server,
> and still have the same issue.
>
> A few days ago I had no problems getting this to work, but now even
> when trying to create a new project I still get the same error.
> Any ideas as to what I'm missing or what might be happening?
>
> Thanks in advance for any help :-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



already logged in users

2011-04-19 Thread Luterien
Hello. I'm working on a django project and now i'm writing
register,login and logout pages. I dont want already logged in users
to access register or login pages. Is it possible to do that on the
template side or do i need to modify my login view ?

Any help appreciated!
Thanks

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



Re: already logged in users

2011-04-19 Thread Oleg Lomaka
{% if user.is_authenticated %}
  Hello, what are you doing here?
{% else %}
  Show login/registration form here
{% endif %}

Also I think doing it in templates is not right. It's job for decorators.

On Tue, Apr 19, 2011 at 7:46 PM, Luterien  wrote:

> Hello. I'm working on a django project and now i'm writing
> register,login and logout pages. I dont want already logged in users
> to access register or login pages. Is it possible to do that on the
> template side or do i need to modify my login view ?
>
>

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



Re: For any dictionary in a list, does a value exist for a key?

2011-04-19 Thread bruno desthuilliers


On 18 avr, 18:27, Shawn Milochik  wrote:
> You can do this pretty easily in Python with any():
>
> if any(['foo' in x for x in my_list]):
>     #do something

should be:

if any(x['id'] == 'foo' for x in mylist):
do_something()


Your above snippet will test if a dict in my_list has a *key* named
'foo'.

> However, I don't know of a way to do it in a template, which is what
> it appears you're asking.

# myapp/templatetags/mytags.py
@register.filter
def test_id(list_of_dicts, val):
for dic in list_of_dicts:
if dic.get('id', '') == val:
return True
return False


# mytemplate.html

{% load mytags %}
{% if my_list|test_id:"foo"%}
   yeps, it's here
{% endif %}

Not tested but you get the idea.

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



Re: admin login fails

2011-04-19 Thread pfc
I did try to delete the db and yes I had to create a new superuser
after, however this did not fix the problem.  I also reset the db from
the command-line and same result.
Also, it is not a capslock issue, first thing I checked ;-)
The only thing I can think of that is non-standard would be the fact
that this is on a usb drive, however this shouldn't make a difference
as after copying the projects to my internal HDD I get the same
result.

Is there some way to get more debug info(compared to just saying that
the username/password is wrong)?


On Apr 19, 11:48 am, Ernesto Guevara  wrote:
> Or you can delete database and execute again syncdb. The aplication ask
> again the password, warning for capslock. =)
>
> 2011/4/19 pfc 
>
>
>
>
>
>
>
> > I'm new to Django and am following the tutorials, specifically:
> >http://docs.djangoproject.com/en/dev/intro/tutorial02/
> > I followed the instructions on adding admin to the INSTALLED_APPS, I
> > also added it to the urls, did syncdb and created the superuser.  When
> > trying to login with the superuser(username test, password test) I
> > then get the message "Please enter a correct username and password.
> > Note that both fields are case-sensitive."
> > I decided to create a second superuser and restarted the test server,
> > and still have the same issue.
>
> > A few days ago I had no problems getting this to work, but now even
> > when trying to create a new project I still get the same error.
> > Any ideas as to what I'm missing or what might be happening?
>
> > Thanks in advance for any help :-)
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: already logged in users

2011-04-19 Thread Luterien
I'm using the template method for now since i dont know much about
decorators. I tried using the decorators at contrib.auth.decorators
but it didnt work.

Thanks!

On Apr 19, 7:51 pm, Oleg Lomaka  wrote:
> {% if user.is_authenticated %}
>   Hello, what are you doing here?
> {% else %}
>   Show login/registration form here
> {% endif %}
>
> Also I think doing it in templates is not right. It's job for decorators.
>
> On Tue, Apr 19, 2011 at 7:46 PM, Luterien  wrote:
> > Hello. I'm working on a django project and now i'm writing
> > register,login and logout pages. I dont want already logged in users
> > to access register or login pages. Is it possible to do that on the
> > template side or do i need to modify my login view ?

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



Re: already logged in users

2011-04-19 Thread Shawn Milochik
On Tue, Apr 19, 2011 at 2:01 PM, Luterien  wrote:
> I'm using the template method for now since i dont know much about
> decorators. I tried using the decorators at contrib.auth.decorators
> but it didnt work.

Doing something the wrong way you're comfortable with instead of
making yourself better at your job is really, really. bad. Just FYI. I
definitely wouldn't hire someone who cares that little about not doing
a horrible job that someone else is going to have to deal with in the
future.

You could also handle your original request in middleware. Technically
you could do it in a template by using the template language to write
JavaScript that would redirect, but that's still bad. The easiest way
is probably in the login view itself -- check if the request.user
either is_authenticated or is_anonymous and redirect as appropriate.

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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: admin login fails

2011-04-19 Thread Nick Stinemates
On Tue, Apr 19, 2011 at 5:36 PM, pfc  wrote:

> I did try to delete the db and yes I had to create a new superuser
> after, however this did not fix the problem.  I also reset the db from
> the command-line and same result.
> Also, it is not a capslock issue, first thing I checked ;-)
> The only thing I can think of that is non-standard would be the fact
> that this is on a usb drive, however this shouldn't make a difference
> as after copying the projects to my internal HDD I get the same
> result.
>
> Is there some way to get more debug info(compared to just saying that
> the username/password is wrong)?
>

Are you running

python manage.py testserver

instead of

python manage.py runserver ?

This has caused a problem for me in the past.


>
>
> On Apr 19, 11:48 am, Ernesto Guevara  wrote:
> > Or you can delete database and execute again syncdb. The aplication ask
> > again the password, warning for capslock. =)
> >
> > 2011/4/19 pfc 
> >
> >
> >
> >
> >
> >
> >
> > > I'm new to Django and am following the tutorials, specifically:
> > >http://docs.djangoproject.com/en/dev/intro/tutorial02/
> > > I followed the instructions on adding admin to the INSTALLED_APPS, I
> > > also added it to the urls, did syncdb and created the superuser.  When
> > > trying to login with the superuser(username test, password test) I
> > > then get the message "Please enter a correct username and password.
> > > Note that both fields are case-sensitive."
> > > I decided to create a second superuser and restarted the test server,
> > > and still have the same issue.
> >
> > > A few days ago I had no problems getting this to work, but now even
> > > when trying to create a new project I still get the same error.
> > > Any ideas as to what I'm missing or what might be happening?
> >
> > > Thanks in advance for any help :-)
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: admin login fails

2011-04-19 Thread pfc
Thank you so much
that's all it was!

On Apr 19, 2:19 pm, Nick Stinemates  wrote:
> On Tue, Apr 19, 2011 at 5:36 PM, pfc  wrote:
> > I did try to delete the db and yes I had to create a new superuser
> > after, however this did not fix the problem.  I also reset the db from
> > the command-line and same result.
> > Also, it is not a capslock issue, first thing I checked ;-)
> > The only thing I can think of that is non-standard would be the fact
> > that this is on a usb drive, however this shouldn't make a difference
> > as after copying the projects to my internal HDD I get the same
> > result.
>
> > Is there some way to get more debug info(compared to just saying that
> > the username/password is wrong)?
>
> Are you running
>
> python manage.py testserver
>
> instead of
>
> python manage.py runserver ?
>
> This has caused a problem for me in the past.
>
>
>
>
>
>
>
>
>
> > On Apr 19, 11:48 am, Ernesto Guevara  wrote:
> > > Or you can delete database and execute again syncdb. The aplication ask
> > > again the password, warning for capslock. =)
>
> > > 2011/4/19 pfc 
>
> > > > I'm new to Django and am following the tutorials, specifically:
> > > >http://docs.djangoproject.com/en/dev/intro/tutorial02/
> > > > I followed the instructions on adding admin to the INSTALLED_APPS, I
> > > > also added it to the urls, did syncdb and created the superuser.  When
> > > > trying to login with the superuser(username test, password test) I
> > > > then get the message "Please enter a correct username and password.
> > > > Note that both fields are case-sensitive."
> > > > I decided to create a second superuser and restarted the test server,
> > > > and still have the same issue.
>
> > > > A few days ago I had no problems getting this to work, but now even
> > > > when trying to create a new project I still get the same error.
> > > > Any ideas as to what I'm missing or what might be happening?
>
> > > > Thanks in advance for any help :-)
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Django users" group.
> > > > To post to this group, send email to django-users@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Why i can reach my media files from my static url?

2011-04-19 Thread Mirat Bayrak
Hi, i started a project (with django1.3). I made settings for my media files 
and static files. After that i realized that : i can reach 
/myproject/media/foo.txt from localhost:8000/static/foo.txt .


   1. Why i can reach that from there?
   2. That looks like i don't need to add serve media view to my urls.py?
   3. May be i can make my MEDIA_URL same with STATIC_URL than use both from 
   /static/?

Thanks for your all responses.

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



Re: already logged in users

2011-04-19 Thread Luterien
Thanks for the warning. But dont worry,i had no intention of leaving
it like that. As i said i dont know much about decorators,so i thought
it would be better to learn more about decorators before using them.
So i was reading the docs.

Yes,that is what i was looking for. I modified the login view as you
said and its working the way i want now. Thanks a lot!

On Apr 19, 9:18 pm, Shawn Milochik  wrote:
> On Tue, Apr 19, 2011 at 2:01 PM, Luterien  wrote:
> > I'm using the template method for now since i dont know much about
> > decorators. I tried using the decorators at contrib.auth.decorators
> > but it didnt work.
>
> Doing something the wrong way you're comfortable with instead of
> making yourself better at your job is really, really. bad. Just FYI. I
> definitely wouldn't hire someone who cares that little about not doing
> a horrible job that someone else is going to have to deal with in the
> future.
>
> You could also handle your original request in middleware. Technically
> you could do it in a template by using the template language to write
> JavaScript that would redirect, but that's still bad. The easiest way
> is probably in the login view itself -- check if the request.user
> either is_authenticated or is_anonymous and redirect as appropriate.
>
> 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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Cannot submit tickets - always marked as spam!

2011-04-19 Thread Jeff Blaine
I've tried twice now to interact with the Django trac.  Last week and just 
now.  Both resulted in:

badip:state/blacklist.d/127.0.0.1

Please tell me what I am doing wrong.

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



Re: already logged in users

2011-04-19 Thread Shawn Milochik
Cool. I understand putting a temporary solution in place to get the
job done sometimes.

Glad I could 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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Testing if a receiver is connected to a signal

2011-04-19 Thread Bernardo Fontes
Hi,

I'm having this problem too. Does anyone knows a good strategy to
handle this problem?

On 21 fev, 17:50, Vinicius Mendes  wrote:
> Hi,
>
> I want to test if a receiver function is connected to a signal in django,
> but I don't want other receivers from other apps to be called when my test
> runs.
>
> I thought of verifying if my callback function is in the receivers list of
> the signal, but this list stores the receivers in a strange way.
>
> Any ideas?
>
> Atenciosamente,
> Vinicius Mendes
> Engenheiro de Computação
> Globo.com

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



Admin: Model ordering and relationship conditional __unicode__ return values?

2011-04-19 Thread Micky Hulse
Hello,

Couple of noob questions:

1.

Is it possible to order the models of my app manually (vs.
alphabetically) when viewing the app page?

See attached "ordering.png".

2.

Relationship models: How can I return different __unicode__ values
based on the relationship that I am viewing.

[code]

class SeasonPlayerRelationship(models.Model):

season = models.ForeignKey('Season')
player = models.ForeignKey('Player')

...

def __unicode__(self):
if self.season:
return 'Season'
else:
return 'Player'

[/code]

See attached "relationship.png".

In the screenshot above, just as an example, I would like "Player" to
get returned, and not "Season".

Optimally, I would like to return nothing for the relationship's
__unicode__, but when I do this:

[code]

def __unicode__(self):
return ''

[/code]

There is just a big gap where a __unicode__ label would appear (I
assume it's because the admin is spitting out an empty  or
).

Thanks!
Micky

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

<><>

website path

2011-04-19 Thread Ján Vorčák
Hi,

I've installed a django on my server (running on apache), but I've
configured it to run using url like
www.mydomain.com/django-application/

Now when I access some url from django using absolute url it
automatically redirects me to
www.mydomain.com/someapplication
instead of
www.mydomain.com/django-application/someapplication

Sorry for such a stupid question, but I really can't figure out what's
wrong and where should I configure this behaviour. (settings.py?
apache?)

Thank you

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



Re: website path

2011-04-19 Thread Jeff Blaine
I imagine you need to configure your urls.py

I suggest going through the whole tutorial, starting at the following page. 
 This is all
explained there.

http://docs.djangoproject.com/en/1.3/intro/tutorial01/

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



Re: Why i can reach my media files from my static url?

2011-04-19 Thread Jeff Blaine
Please show your settings:

STATIC_ROOT
STATICFILES_DIR
STATIC_URL
MEDIA_ROOT
MEDIA_URL

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



Re: website path

2011-04-19 Thread Ján Vorčák
Hi
Thank you for your response

Yeah I've already read that,
But in urls.py I have to explicitly say that my url is like django-
application/someaplication
My point is that I want to avoid writing django-application inside
each url (+ in the template Link


On Apr 19, 11:03 pm, Jeff Blaine  wrote:
> I imagine you need to configure your urls.py
>
> I suggest going through the whole tutorial, starting at the following page.
>  This is all
> explained there.
>
> http://docs.djangoproject.com/en/1.3/intro/tutorial01/

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



Re: website path

2011-04-19 Thread Jeff Blaine
How to avoid hardcoding URL paths in your templates:

http://docs.djangoproject.com/en/1.3/ref/templates/builtins/#url

Maybe that helps some?

I don't think I can be of more help.  I'm too new.

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



Debugging a unittest

2011-04-19 Thread Thomas Weholt
I'm wondering if anybody has a hint on how to debug a unittest, or any
other piece of code in django, for that matter, using a debugger like
winpdb?
I'm trying to to a winpdb manage.py test photo, which runs my unittest
for my photo app, but winpdb crashes. Are there alternatives? What is
the best way to do this?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



compressing uploaded file

2011-04-19 Thread Daniel Gerzo

Hello all,

I am uploading some text files through django (using a form FileField), 
and I am getting InMemoryUploadedFile objects this way. In my 
handle_uploaded_subtitles() method, which gets the list of 
InMemoryUploadedFile objects, I would like to compress these files (so 
that I will get either gzip or bzip2 file, and then save it to a 
FileField model field.


Currently, I have a this code:

def handle_uploaded_subtitles(self, files):
for file in files:
sub_file = SubtitleFile(file_name=file.name, etc)
# here I need to compress the file
sub_file.file.save(file.name, file)

Does anyone here have an idea how can I accomplish this?
Thanks!

--
Kind regards
  Daniel

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



Unidirectional relations

2011-04-19 Thread Juan Pablo Romero Méndez
Hello,

Is it possible to create unidirectional relations within django's orm?

What I mean is a situation where a parent has a children_set of
references to children, but the children don't have any reference to
the father.


Regards,

  Juan Pablo

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



Re: Debugging a unittest

2011-04-19 Thread Shawn Milochik
www.doughellmann.com/PyMOTW/pdb/

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



Re: Cannot submit tickets - always marked as spam!

2011-04-19 Thread Jacob Kaplan-Moss
Hi Jeff --

It's not you; we get a *lot* of spam, and so our spam filters are
overly aggressive.

You can get around 'em if you create an account. Just visit
http://www.djangoproject.com/accounts/register/, register, and then
log into Trac once you have the account set up.

Thanks, and sorry about the false positive!

Jacob

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



Re: db routing by request

2011-04-19 Thread Jacob Kaplan-Moss
On Tue, Apr 19, 2011 at 5:06 AM, Michael P. Soulier
 wrote:
> I noticed that the request object is not passed to the database router, the
> intention seems to mainly be to route by model. I have a case where I want to
> route based on session data in the request. While I know that I can
> explicitely use the using() method, this will be a tad labourious. Will it be
> possible in the future to pass the request object to the database router?

Probably not -- that'd be a pretty heinous violation of separation of
concerns. Remember that Django can (and often is) used outside of a
web request/response cycle (think management commands, cron jobs,
interactive shells, ...).

The right way is indeed to use `using()` and leave session-specific
handling where it belongs, in the views.

[If you insist on making it automagical, you could stuff the request
object in a threadlocal. That wouldn't pass *my* code review, but
luckily you don't work for me :)]

Jacob

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



Re: website path

2011-04-19 Thread Jacob Kaplan-Moss
2011/4/19 Ján Vorčák :
> I've installed a django on my server (running on apache), but I've
> configured it to run using url like
> www.mydomain.com/django-application/
>
> Now when I access some url from django using absolute url it
> automatically redirects me to
> www.mydomain.com/someapplication
> instead of
> www.mydomain.com/django-application/someapplication

This sounds like a problem I've seen when using Django under
mod_python -- are you using mod_python?

Either way, can you share your Apache config and the relevent
URLconfs? It's hard to figure out what's wrong without all the
details.

Jacob

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



Re: compressing uploaded file

2011-04-19 Thread Julio Ona
Hi Daniel,

you should see:
http://docs.python.org/library/bz2.html#module-bz2

or
http://docs.python.org/library/gzip.html#module-gzip

But basically you should import the compress function from the library and
use it.

from bz2 import
compress

[...]


def handle_uploaded_subtitles(self, files):
   for file in files:
   sub_file = SubtitleFile(file_name=file.name, etc)
   bz_file = compress(file)
   sub_file.file.save(file.name, bz_file)

Regards,

On Tue, Apr 19, 2011 at 7:36 PM, Daniel Gerzo  wrote:

> Hello all,
>
> I am uploading some text files through django (using a form FileField), and
> I am getting InMemoryUploadedFile objects this way. In my
> handle_uploaded_subtitles() method, which gets the list of
> InMemoryUploadedFile objects, I would like to compress these files (so that
> I will get either gzip or bzip2 file, and then save it to a FileField model
> field.
>
> Currently, I have a this code:
>
> def handle_uploaded_subtitles(self, files):
>for file in files:
>sub_file = SubtitleFile(file_name=file.name, etc)
># here I need to compress the file
>sub_file.file.save(file.name, file)
>
> Does anyone here have an idea how can I accomplish this?
> Thanks!
>
> --
> Kind regards
>  Daniel
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Julio Ona

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



Re: Unidirectional relations

2011-04-19 Thread Jacob Kaplan-Moss
2011/4/19 Juan Pablo Romero Méndez :
> Is it possible to create unidirectional relations within django's orm?
>
> What I mean is a situation where a parent has a children_set of
> references to children, but the children don't have any reference to
> the father.

See the documentation for ForeignKey.related_name:
http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.related_name.
In particular, note the part about what `related_name="+"` does.

Jacob

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



Re: Unidirectional relations

2011-04-19 Thread Mike Dewhirst
I think you would need an intermediate table 1:n with the parent containing the 
child ids. Otherwise the children need a foreign key reference to the parent. 

On 20/04/2011, at 10:06 AM, Juan Pablo Romero Méndez  
wrote:

> Hello,
> 
> Is it possible to create unidirectional relations within django's orm?
> 
> What I mean is a situation where a parent has a children_set of
> references to children, but the children don't have any reference to
> the father.
> 
> 
> Regards,
> 
>  Juan Pablo
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



satchmo: different price for difference areas

2011-04-19 Thread ug Charlie
I am a django beginner. I just made a shop with satchmo.

I want to set two price for one product. It is like one button in my
page to select the area and display different price for USD or EURO.
Could you give me some advice?

Thanks. :)

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



Re: Please Help a django Beginner!

2011-04-19 Thread nishant kashyap
u can use the link www.djangobook.com
try the second edition book .
you may also find the .pdf of this on the net.
after reading this u can go for the documentation of the django .

On Apr 19, 5:36 pm, "Sells, Fred" 
wrote:
> I received this helpful hint from Shawn M. when faced with the same issue:
> import os
>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'  #whereever your 
> settings.py is located.
>
> From the 
> docs:http://docs.djangoproject.com/en/dev/topics/settings/-Original 
> Message-
> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
> Behalf Of Aviv Giladi
> Sent: Friday, April 15, 2011 2:41 PM
> To: Django users
> Subject: Re: Please Help a django Beginner!
>
> Thank you for the response. Is there any documentation / books out
> there that you would recommend reading to get acquainted with django
> in that perspective?
>
> On Apr 15, 10:58 am, Jirka Vejrazka  wrote:
> > I use Djano ORM for a lot of my backend processing where no web is
> > involved. Just make sure that DJANGO_SETTINGS_MODULE is defined in
> > your environment and you can use pretty much any part of Django in
> > your own code/scrits/whatever.
>
> >   HTH
>
> >     Jirka
>
> > On 15/04/2011, Aviv Giladi  wrote:
>
> > > Hey guys,
>
> > > I am an experienced Python developer starting to work on web service
> > > backend system. The system feeds data (constantly) from the web to a
> > > MySQL database. This data is later displayed by a frontend side (there
> > > is no connection between the frontend and the backend). The backend
> > > system constantly downloads flight information from the web (some of
> > > the data is fetched via APIs, and some by downloading and parsing
> > > text / xls files). I already have a script that downloads the data,
> > > parses it, and inserts it to the MySQL db - all in a big loop. The
> > > frontend side is just a bunch of php pages that properly display the
> > > data by querying the MySQL server.
>
> > > It is crucial that this web service be robust, strong and reliable.
> > > Therefore, I have been looking into the proper ways to design it, and
> > > got the following recommendation:
> > > django as the framework (over Apache).
> > > wrapping my sources with Piston for API usage.
> > > All if this sounds great. I used django before to write websites (aka
> > > request handlers that return data). However I don't see how django can
> > > fulfill a role of a constant running (non request-serving) system -
> > > being that it uses views/forms, which are not a part of my backend
> > > system. Is want I want at all possible / advisable with django? Is
> > > django what you would recommend for this?
> > > If so, could you please refer me to some documentation / help files
> > > more specific to my needs?
>
> > > Thank you so much,
> > > Aviv
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> 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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.