select_related() - suddenly to result

2013-02-01 Thread Szabo, Patrick (LNG-VIE)
Hi,

I have the following query:

Buch = Buchung.objects.filter(Produkt = int(POSTvalues['Produkt']))

Later I'm using stuff like:

Buch.Produkt.Bestell_Nr

To speed things up i wan't to use select_related() on the query but no mather 
where I add it if I add it i get 0 entries as a result where without 
select_related() I do get entries.

I've tried this:

Buch = Buchung.objects.filter(Produkt = 
int(POSTvalues['Produkt'])).select_related()

and

Buch = Buchung.objects.select_related().filter(Produkt = 
int(POSTvalues['Produkt']))

Any ideas why the results are wrong if I use select_related()

cheers


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
Developer
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 1 53452 1573
Fax.: +43 1 534 52 146

. . . . . . . . . . . . . . . . . . . . . . . . . .

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




AW: Kindly help for an interview with Google on python django

2013-01-31 Thread Szabo, Patrick (LNG-VIE)
I’d be interessted if they are still using python or if they moved to „go“ 
entirely.


Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von laxmikant ratnaparkhi
Gesendet: Donnerstag, 31. Jänner 2013 16:15
An: django-users@googlegroups.com
Betreff: Kindly help for an interview with Google on python django

Hello Everybody,
  I have an interview scheduled on monday with google. So can you anybody 
have an related information  or any experience. Please help me what would be 
asked for this interview.
 I have 2 years of exp in python and django.

Thanks in advance!!!

regards,

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





. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo

Developer

LexisNexis

A-1030 Wien, Marxergasse 25



patrick.sz...@lexisnexis.at

Tel.: +43 1 53452 1573

Fax.: +43 1 534 52 146

. . . . . . . . . . . . . . . . . . . . . . . . . .


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




AW: Execution time of a long process results in an Internal Server Error 500

2013-01-10 Thread Szabo, Patrick (LNG-VIE)
I’ve had the exact same problem a couple of weeks ago.
There is a timout that you can define for apache however it somehow didn’t take 
when i tried it.
You really should consider a background task, as Bill suggested.

For me it was a query that took forever. I was able to cut the time in half by 
going through this:
https://docs.djangoproject.com/en/1.1/topics/db/optimization/

Especially select_related() helped a lot !
https://docs.djangoproject.com/en/1.1/ref/models/querysets/#select-related


Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Bill Freeman
Gesendet: Donnerstag, 10. Jänner 2013 14:47
An: django-users@googlegroups.com
Betreff: Re: Execution time of a long process results in an Internal Server 
Error 500

Maybe.  But it's generally considered a bad idea to tie up a request thread for 
that long.

A more common solution is to arrange for a background task to do the heavy 
lifting.

If the user must know when the task is done, you can poll in JavaScript.

Bill
On Thu, Jan 10, 2013 at 8:21 AM, Mauro Sánchez 
mailto:maur...@gmail.com>> wrote:
Hello, I have a process that takes about 2 or 3 minutes to execute. The problem 
is that sometimes (not always) it results in an Internal Server Error 500 
because of the time it takes.
Is there a way to configure Apache or mod_wsgi to prevent this? Let's say, that 
even if the process takes 10 or 15 minutes it just keeps running until it 
finish?
Thanks a lot for the help.
Cheers,
Mauro.
--
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.



. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo

Developer

LexisNexis

A-1030 Wien, Marxergasse 25



patrick.sz...@lexisnexis.at

Tel.: +43 1 53452 1573

Fax.: +43 1 534 52 146

. . . . . . . . . . . . . . . . . . . . . . . . . .


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



AW: problem with timeout

2012-12-17 Thread Szabo, Patrick (LNG-VIE)
Nevermind…select_related() did the trick.
226 queries cut to 4…amazing this little statement ☺




. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo

Developer

LexisNexis

A-1030 Wien, Marxergasse 25



patrick.sz...@lexisnexis.at<mailto:patrick.sz...@lexisnexis.at>

Tel.: +43 1 53452 1573

Fax.: +43 1 534 52 146

. . . . . . . . . . . . . . . . . . . . . . . . . .


Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Szabo, Patrick (LNG-VIE)
Gesendet: Dienstag, 18. Dezember 2012 08:08
An: django-users@googlegroups.com
Betreff: AW: problem with timeout

Thanks, that does sound like a better idea and now that i think about it i saw 
this behaviour on many other webinterfaces already…don’t know why i didn’t 
think about that ☺

However I’ve noticed that it’s not the query that is taking so long, it’s the 
processing of the result that takes ~180 seconds…yes 10 minutes might have been 
a little exaggerated ;-)

It’s this code:

for buchung in buchungen:
if str(buchung.Produkt.Bestell_Nr):
   buch_pool[str(buchung.Produkt) + " #" + 
str(buchung.Produkt.Bestell_Nr)].append([str(buchung.Aktivitaet), 
str(buchung.Minuten)])
else:

buch_pool[str(buchung.Produkt)].append([str(buchung.Aktivitaet), 
str(buchung.Minuten)])

You mightbe wondering why I’m even building such a weird construct. Truth is, 
this thing has grown over time with different devs working on it and I don’t 
have time to change it.

My guess is that this code is triggering a load of queries…any idea how to make 
this more efficient ?


Von: django-users@googlegroups.com<mailto:django-users@googlegroups.com> 
[mailto:django-users@googlegroups.com] Im Auftrag von Russell Keith-Magee
Gesendet: Dienstag, 18. Dezember 2012 00:55
An: django-users@googlegroups.com<mailto:django-users@googlegroups.com>
Betreff: Re: problem with timeout


On Mon, Dec 17, 2012 at 7:34 PM, Szabo, Patrick (LNG-VIE) 
mailto:patrick.sz...@lexisnexis.at>> wrote:
Hi,

I have an operation that takes about 10 minutes to befinished. It takes that 
long because our DB is pretty big.
This produces a timeout.

I have tried so set the timeout in apache higher but it seems that apache is 
not taking this directivejust keeps timing out after 300 seconds.

Is there anything I can to to overcome this within my app ?
Yes. Stop doing long lived operations in a web request.

Seriously, stop. :-)

HTTP is designed to be a large number of short lived operations, not long lived 
operations. At the moment, you're hitting a resource limit at the HTTP server, 
but I'd be deeply surprised if that's the only problem you hit. HTTP just isn't 
designed to work in the way you've described.

If you need to perform a long lived operation, you need to structure your 
workflow differently. Instead of a single request that takes 10 minutes to 
create a response, you:

 1) Issue a request that creates a record in the database with all the details 
necessary to start the "job"
 2) Return to the user a success message that indicates work has started.
 3) In the background, in a *completely separate process*, process the job.
 4) When the job is finished, insert the results into the database, and mark 
the job as finished
 5) If the user hits the page representing the job, they can view the results.

The important detail here is that you get the heavy lifting *out* of the 
request-response cycle. How you achieve that is up to you. On the very simple 
end, you just have a job status page that the user manually reloads, and a cron 
task in the background to do the heavy lifting. On the complex end, you could 
use long polling or web sockets to provide the status update, and something 
like Celery to handle the task management.

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



. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo

Developer

LexisNexis

A-1030 Wien, Marxergasse 25



patrick.sz...@lexisnexis.at<mailto:patrick.sz...@lexisnexis.at>

Tel.: +43 1 53452 1573

Fax.: +43 1 534 52 146

. . . . . . . . . . . . . . . . . . . . . . . . . .


--
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<mailto:django-users@googlegroups.com>.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+uns

AW: problem with timeout

2012-12-17 Thread Szabo, Patrick (LNG-VIE)
Thanks, that does sound like a better idea and now that i think about it i saw 
this behaviour on many other webinterfaces already…don’t know why i didn’t 
think about that ☺

However I’ve noticed that it’s not the query that is taking so long, it’s the 
processing of the result that takes ~180 seconds…yes 10 minutes might have been 
a little exaggerated ;-)

It’s this code:

for buchung in buchungen:
if str(buchung.Produkt.Bestell_Nr):
   buch_pool[str(buchung.Produkt) + " #" + 
str(buchung.Produkt.Bestell_Nr)].append([str(buchung.Aktivitaet), 
str(buchung.Minuten)])
else:

buch_pool[str(buchung.Produkt)].append([str(buchung.Aktivitaet), 
str(buchung.Minuten)])

You mightbe wondering why I’m even building such a weird construct. Truth is, 
this thing has grown over time with different devs working on it and I don’t 
have time to change it.

My guess is that this code is triggering a load of queries…any idea how to make 
this more efficient ?


Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Russell Keith-Magee
Gesendet: Dienstag, 18. Dezember 2012 00:55
An: django-users@googlegroups.com
Betreff: Re: problem with timeout


On Mon, Dec 17, 2012 at 7:34 PM, Szabo, Patrick (LNG-VIE) 
mailto:patrick.sz...@lexisnexis.at>> wrote:
Hi,

I have an operation that takes about 10 minutes to befinished. It takes that 
long because our DB is pretty big.
This produces a timeout.

I have tried so set the timeout in apache higher but it seems that apache is 
not taking this directivejust keeps timing out after 300 seconds.

Is there anything I can to to overcome this within my app ?
Yes. Stop doing long lived operations in a web request.

Seriously, stop. :-)

HTTP is designed to be a large number of short lived operations, not long lived 
operations. At the moment, you're hitting a resource limit at the HTTP server, 
but I'd be deeply surprised if that's the only problem you hit. HTTP just isn't 
designed to work in the way you've described.

If you need to perform a long lived operation, you need to structure your 
workflow differently. Instead of a single request that takes 10 minutes to 
create a response, you:

 1) Issue a request that creates a record in the database with all the details 
necessary to start the "job"
 2) Return to the user a success message that indicates work has started.
 3) In the background, in a *completely separate process*, process the job.
 4) When the job is finished, insert the results into the database, and mark 
the job as finished
 5) If the user hits the page representing the job, they can view the results.

The important detail here is that you get the heavy lifting *out* of the 
request-response cycle. How you achieve that is up to you. On the very simple 
end, you just have a job status page that the user manually reloads, and a cron 
task in the background to do the heavy lifting. On the complex end, you could 
use long polling or web sockets to provide the status update, and something 
like Celery to handle the task management.

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



. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo

Developer

LexisNexis

A-1030 Wien, Marxergasse 25



patrick.sz...@lexisnexis.at<mailto:patrick.sz...@lexisnexis.at>

Tel.: +43 1 53452 1573

Fax.: +43 1 534 52 146

. . . . . . . . . . . . . . . . . . . . . . . . . .


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



problem with timeout

2012-12-17 Thread Szabo, Patrick (LNG-VIE)
Hi,

I have an operation that takes about 10 minutes to befinished. It takes that 
long because our DB is pretty big.
This produces a timeout.

I have tried so set the timeout in apache higher but it seems that apache is 
not taking this directivejust keeps timing out after 300 seconds.

Is there anything I can to to overcome this within my app ?

The exception says that a connections was aborted by the software oft he 
hostcomputer (translated from german): core_output_filter: writing data to the 
network

This is how i get the entries:

Datum being a Date and int(str(datestring).split('-')[0]) delivering a year 
like 2012

Buchung.objects.filter(Datum__year = int(str(datestring).split('-')[0]))


Help would be much appreciated.



. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
Developer
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 1 53452 1573
Fax.: +43 1 534 52 146

. . . . . . . . . . . . . . . . . . . . . . . . . .

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



AW: DetailView

2012-11-21 Thread Szabo, Patrick (LNG-VIE)
Hi,

Code looks fine to me, maybe you could give us the exact error message ?
You could also try request.user.id or something to get the actual pk and not 
only the user object  but that’s just a guess.

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von David
Gesendet: Mittwoch, 21. November 2012 16:45
An: django-users@googlegroups.com
Betreff: DetailView

Hello

I am trying to use a class based generic view (DetailView) to view user 
profiles.

What I am trying to achieve is: if no user PK is provided in the URL show the 
logged in user. If there is a user PK in the URL show that user. Thus reducing 
the need to have 2 views.

My code currently errors out complaining of a missing key error "pk" if I do 
not specify a PK in the URL. If a PK is supplied in the URL it works fine.

Any help would be appreciated.

Thank you


This is my code so far:

class home(DetailView):
context_object_name = 'profile'
template_name = 'view_profile.html'

def get_context_data(self, **kwargs):
context = super(home, self).get_context_data(**kwargs)
u_ct = ContentType.objects.get_for_model(get_user_model()).id

context.update({
'profile_ct': u_ct,
})
return context

def get_queryset(self):
UserModel = get_user_model()

pk = self.kwargs['pk']

if not pk:
profile = UserModel.objects.filter(pk=self.request.user)
else:
profile = UserModel.objects.filter(pk=self.kwargs['pk'])
return profile
--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/yXHgVvDdOaEJ.
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.



. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo

Developer

LexisNexis

A-1030 Wien, Marxergasse 25



patrick.sz...@lexisnexis.at

Tel.: +43 1 53452 1573

Fax.: +43 1 534 52 146

. . . . . . . . . . . . . . . . . . . . . . . . . .


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



AW: Post data Query Dict - Why not a list ?

2012-02-29 Thread Szabo, Patrick (LNG-VIE)
Exactly what i was looking for...thx a lot!


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 1 53452 1573 
Fax: +43 1 534 52 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Masklinn
Gesendet: Mittwoch, 29. Februar 2012 10:03
An: django-users@googlegroups.com
Betreff: Re: Post data Query Dict - Why not a list ?

On 2012-02-29, at 09:46 , Szabo, Patrick (LNG-VIE) wrote:
> Hi, 
> 
> If i do 
> 
> for key in request.POST.keys():
> 
> print request.POST[key]
> 
> Over this (which is the result of print request.Post):
> 
>  u'29', u'42']}>
> 
> I get:
> 
> Monatsreport
> 
> 42
> 
> Should I not get  lists ?

No, multidicts generally conform to the dict interface (mapping a
key to a value) as it's the most useful way to interact with POSTDATA
(or GETDATA for that matter): people will generally map a single value
to each key and having to unpack that value all the time is a pain.

If you want to get all values for the key, as the documentation
indicates[0] you should use the `getlist` method.

[0] 
https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.QueryDict.getlist

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



Post data Query Dict - Why not a list ?

2012-02-29 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

If i do 

 

for key in request.POST.keys():

print request.POST[key]

 

Over this (which is the result of print request.Post):

 



 

I get:

 

Monatsreport

42

 

Should I not get  lists ?

 

i.e:

 

[Monatsreport]

[2,29,42]

 

I need those other information from  'my_choice_field' how do I get them
?

 

Help would be much appreciated.

 

Best regards

 


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 1 53452 1573 
Fax: +43 1 534 52 146 





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



AW: custom tag not working

2012-02-28 Thread Szabo, Patrick (LNG-VIE)
Nevermind...i loaded the filter.py in the wrong template -.-

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Szabo, Patrick
(LNG-VIE)
Gesendet: Dienstag, 28. Februar 2012 13:15
An: django-users@googlegroups.com
Betreff: custom tag not working

 

Hi, 

 

I want to perform a substring on certain texts in my template (I can't
substring beforelong story -.-).

I already have custom tags working so I really don't know why this one
isn't.

In the files where I have the other tags as well I did this:

 

@register.filter(name ="cutnr")

@stringfilter

def cutnr(prodstr):

return substring_before(prodstr, " #")

 

In my template there is:

 

{% for produkt, akt in produkte.items %}



{{ var|cutnr:"asdsa#sss" }}

...

 

So for testing i wanted to give my function a random string just to
check it out. 

Unfortunately I get this: 

 

Exception Value:

Invalid filter: 'cutnr'

 

Any ideas ?

 

Best regards

. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo
XSLT Developer 

LexisNexis
A-1030 Wien, Marxergasse 25

patrick.sz...@lexisnexis.at

Tel.: +43 1 53452 1573 

Fax: +43 1 534 52 146 

 

 

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 1 53452 1573 
Fax: +43 1 534 52 146 





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



custom tag not working

2012-02-28 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I want to perform a substring on certain texts in my template (I can't
substring beforelong story -.-).

I already have custom tags working so I really don't know why this one
isn't.

In the files where I have the other tags as well I did this:

 

@register.filter(name ="cutnr")

@stringfilter

def cutnr(prodstr):

return substring_before(prodstr, " #")

 

In my template there is:

 

{% for produkt, akt in produkte.items %}



{{ var|cutnr:"asdsa#sss" }}

...

 

So for testing i wanted to give my function a random string just to
check it out. 

Unfortunately I get this: 

 

Exception Value:

Invalid filter: 'cutnr'

 

Any ideas ?

 

Best regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 1 53452 1573 
Fax: +43 1 534 52 146 





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



AW: Need "edit" and "delete" buttons on each line of a rendered table

2012-01-16 Thread Szabo, Patrick (LNG-VIE)
Hi, 

I'm doing the exact same thing. What i do is i add the id of the object of a 
row to the url that the button is linking to. 
Then I use urls.py and views.py to identify that id and delete or add the 
object. 

cheers


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 1 534 52 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Bill Beal
Gesendet: Montag, 16. Jänner 2012 14:55
An: Django users
Betreff: Need "edit" and "delete" buttons on each line of a rendered table

Hi All,

I'm trying to render a table and have an EDIT
button and a DELETE button on each line, like:

ID numberID typeEDITDELETE

and identify which line is to be EDITed
or DELETEd.  I tried to create a unique name
for each button, like:



but the template language won't let me add.
Is there a simpler way to know which line
the submit came from, that works?
Or even a complicated way that works?

Bill Beal

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



AW: help optimizing a snippet

2011-12-06 Thread Szabo, Patrick (LNG-VIE)
Amazing12 queries left and that's hell of a lot faster J

 

Thank you guys !

 

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Felipe Morales
Gesendet: Dienstag, 06. Dezember 2011 15:24
An: django-users@googlegroups.com
Betreff: Re: help optimizing a snippet

 

Hi, 

 

Maybe I can't understand you, but try with

 

u = User.objects.filter(groups__name__in = 
gruppe).exclude(groups__name__in='Timesheet-Boss','TimeSheet-Manager','Projektleiter','Normal-User','Manager']).values_list('id',
 'username')

 

2011/12/6 Szabo, Patrick (LNG-VIE) 

Hi, 

 

I'v got this piece of code:

 

def get_my_choices(gruppe):

users = User.objects.all()

choices_list = ()

for user in users:

try:

for groupe in gruppe:

for groupe2 in user.groups.all():

if groupe2 == groupe and (user.id,user) not in choices_list 
and groupe2.name not in 
['Timesheet-Boss','TimeSheet-Manager','Projektleiter','Normal-User','Manager']:

choices_list += ((user.id,user),)

except:

pass

return choices_list

 

The parameter is the result of a user.groups.all() call. 

This function causes over db-queries and I was wondering if anyone sees a way 
of optimizing that a little bit. 

I was playing around with values_list() but couldn't get it working.

 

Any ideas ?

 

regards 

. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo
XSLT Developer 

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: 00431 534521573   

Fax: +43 (1) 534 52 - 146   

 

 

-- 
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 
<mailto:django-users%2bunsubscr...@googlegroups.com> .
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.





 

-- 
Felipe Morales C.
Ingenierío de Ejecución en Computación e Informática.

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



help optimizing a snippet

2011-12-06 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I'v got this piece of code:

 

def get_my_choices(gruppe):

users = User.objects.all()

choices_list = ()

for user in users:

try:

for groupe in gruppe:

for groupe2 in user.groups.all():

if groupe2 == groupe and (user.id,user) not in
choices_list and groupe2.name not in
['Timesheet-Boss','TimeSheet-Manager','Projektleiter','Normal-User','Man
ager']:

choices_list += ((user.id,user),)


except:

pass

return choices_list

 

The parameter is the result of a user.groups.all() call. 

This function causes over db-queries and I was wondering if anyone sees
a way of optimizing that a little bit. 

I was playing around with values_list() but couldn't get it working.

 

Any ideas ?

 

regards 


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



AW: AW: Performance

2011-12-05 Thread Szabo, Patrick (LNG-VIE)
Okay it seems that specifying which Foreign-Keys it should follow solves
the problem. 

Is this a known issue and can I be sure that this won't cause any
further trouble !?

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Szabo, Patrick
(LNG-VIE)
Gesendet: Dienstag, 06. Dezember 2011 08:29
An: django-users@googlegroups.com
Betreff: AW: AW: Performance

 

Thank you, i could cut my queries in half which brings almost a second J

Unfortunately the function seems to effect the results.

 

If I run the query with select_related() I get 151 objects. 

Without select_related() I get 199. 

 

Is there something I can to to overcome this ?!

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Felipe Morales
Gesendet: Montag, 05. Dezember 2011 17:50
An: django-users@googlegroups.com
Betreff: Re: AW: Performance

 

Patrick, 

 

try to use select_related() method instead of only filter() when you get
a list of elements, e.g. :

 

queryset = Model.objects.filter().select_related()

 

by this way you'll get only one query instead 800

 

good luck!

 

Felipe

2011/12/5 Nikolas Stevenson-Molnar 

It would help to know a little more about your code here. Could you give
some examples?

 

_NIk

 

On Dec 5, 2011, at 3:18 AM, Szabo, Patrick (LNG-VIE) wrote:

 

Okay that toolbar is really useful and also looks kind of nice
J...Thanks for that.

I've already found the problemsomehow my app triggers 800 queries
just for a simple page.

Can I somehow find out which part of my code is causing those queries ?!

 

patrick

 

 

. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo
XSLT Developer

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: 00431 534521573  

Fax: +43 (1) 534 52 - 146  

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Nikolas
Stevenson-Molnar
Gesendet: Montag, 05. Dezember 2011 08:14
An: Nikolas Stevenson-Molnar
Cc: django-users@googlegroups.com
Betreff: Re: Performance

 

A bit more searching turned up something even better... looks like the
Django folks address this directly:
https://code.djangoproject.com/wiki/ProfilingDjango

 

_Nik

 

On Dec 4, 2011, at 11:03 PM, Nikolas Stevenson-Molnar wrote:

 

I haven't done this myself, but I would assume you could use the Python
profiler. Here's one project that facilitates profiling a WSGI app
(assuming you're using Django via WSGI): http://repoze.org/

 

Others here may have more experience with profiling web apps.

 

_Nik

 

On Dec 4, 2011, at 10:55 PM, Szabo, Patrick (LNG-VIE) wrote:

 

Hi,

 

In the last couple of weeks my app has become quite slowly and I'm
wondering why that is.

Are there any debugging tools where I can see what takes how much time ?

 

cheers

 

. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo
XSLT Developer

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: 00431 534521573  

Fax: +43 (1) 534 52 - 146  

 

 

 

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

 

-- 
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
<mailto:django-users%2bunsubscr...@googlegroups.com> .
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.





 

-- 
Felipe Morales C.
Ingeniero de Ejecucin en Computacin e Informtica.

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

AW: AW: Performance

2011-12-05 Thread Szabo, Patrick (LNG-VIE)
Thank you, i could cut my queries in half which brings almost a second J

Unfortunately the function seems to effect the results.

 

If I run the query with select_related() I get 151 objects. 

Without select_related() I get 199. 

 

Is there something I can to to overcome this ?!

 

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Felipe Morales
Gesendet: Montag, 05. Dezember 2011 17:50
An: django-users@googlegroups.com
Betreff: Re: AW: Performance

 

Patrick, 

 

try to use select_related() method instead of only filter() when you get a list 
of elements, e.g. :

 

queryset = Model.objects.filter().select_related()

 

by this way you'll get only one query instead 800

 

good luck!

 

Felipe

2011/12/5 Nikolas Stevenson-Molnar 

It would help to know a little more about your code here. Could you give some 
examples?

 

_NIk

 

On Dec 5, 2011, at 3:18 AM, Szabo, Patrick (LNG-VIE) wrote:





Okay that toolbar is really useful and also looks kind of nice J...Thanks for 
that.

I've already found the problemsomehow my app triggers 800 queries just for 
a simple page.

Can I somehow find out which part of my code is causing those queries ?!

 

patrick

 

 

. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo
XSLT Developer

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: 00431 534521573  

Fax: +43 (1) 534 52 - 146  

 

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Nikolas Stevenson-Molnar
Gesendet: Montag, 05. Dezember 2011 08:14
An: Nikolas Stevenson-Molnar
Cc: django-users@googlegroups.com
Betreff: Re: Performance

 

A bit more searching turned up something even better... looks like the Django 
folks address this directly: https://code.djangoproject.com/wiki/ProfilingDjango

 

_Nik

 

On Dec 4, 2011, at 11:03 PM, Nikolas Stevenson-Molnar wrote:

 

I haven't done this myself, but I would assume you could use the Python 
profiler. Here's one project that facilitates profiling a WSGI app (assuming 
you're using Django via WSGI): http://repoze.org/

 

Others here may have more experience with profiling web apps.

 

_Nik

 

On Dec 4, 2011, at 10:55 PM, Szabo, Patrick (LNG-VIE) wrote:

 

Hi,

 

In the last couple of weeks my app has become quite slowly and I'm wondering 
why that is.

Are there any debugging tools where I can see what takes how much time ?

 

cheers

 

. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo
XSLT Developer

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: 00431 534521573  

Fax: +43 (1) 534 52 - 146  

 

 

 

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

 

-- 
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 
<mailto:django-users%2bunsubscr...@googlegroups.com> .
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.





 

-- 
Felipe Morales C.
Ingenierío de Ejecución en Computación e Informática.

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





-- 
You received this message because you are subscribed to the Google Groups 
"Django users"

AW: AW: Performance

2011-12-05 Thread Szabo, Patrick (LNG-VIE)
Thank's for the hints...i'll check it out !


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Tim Sawyer
Gesendet: Montag, 05. Dezember 2011 18:07
An: django-users@googlegroups.com
Betreff: Re: AW: Performance

http://pypi.python.org/pypi/django-debug-toolbar will show the number of
queries, time taken to query, and allow you to see the stack trace for the
code that caused the query to be executed.

Hope that helps,

Tim.

> On Dec 5, 2011, at 3:18 AM, Szabo, Patrick (LNG-VIE) wrote:
>
>> Okay that toolbar is really useful and also looks kind of nice J...Thanks
>> for that.
>> I've already found the problemsomehow my app triggers 800 queries just
>> for a simple page.
>> Can I somehow find out which part of my code is causing those queries ?!
>>
>> patrick
>>
>>
>> . . . . . . . . . . . . . . . . . . . . . . . . . .
>> Ing. Patrick Szabo
>> XSLT Developer
>> LexisNexis
>> Marxergasse 25, 1030 Wien
>>
>> patrick.sz...@lexisnexis.at
>> Tel.: 00431 534521573
>> Fax: +43 (1) 534 52 - 146
>>
>> Von: django-users@googlegroups.com
>> [mailto:django-users@googlegroups.com] Im Auftrag von Nikolas
>> Stevenson-Molnar
>> Gesendet: Montag, 05. Dezember 2011 08:14
>> An: Nikolas Stevenson-Molnar
>> Cc: django-users@googlegroups.com
>> Betreff: Re: Performance
>>
>> A bit more searching turned up something even better... looks like the
>> Django folks address this directly:
>> https://code.djangoproject.com/wiki/ProfilingDjango
>>
>> _Nik
>>
>> On Dec 4, 2011, at 11:03 PM, Nikolas Stevenson-Molnar wrote:
>>
>>
>> I haven't done this myself, but I would assume you could use the Python
>> profiler. Here's one project that facilitates profiling a WSGI app
>> (assuming you're using Django via WSGI): http://repoze.org/
>>
>> Others here may have more experience with profiling web apps.
>>
>> _Nik
>>
>> On Dec 4, 2011, at 10:55 PM, Szabo, Patrick (LNG-VIE) wrote:
>>
>>
>> Hi,
>>
>> In the last couple of weeks my app has become quite slowly and I'm
>> wondering why that is.
>> Are there any debugging tools where I can see what takes how much time ?
>>
>> cheers
>>
>> . . . . . . . . . . . . . . . . . . . . . . . . . .
>> Ing. Patrick Szabo
>> XSLT Developer
>> LexisNexis
>> Marxergasse 25, 1030 Wien
>>
>> patrick.sz...@lexisnexis.at
>> Tel.: 00431 534521573
>> Fax: +43 (1) 534 52 - 146
>>
>>
>>
>> --
>> 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.
>
> --
> 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.



AW: Performance

2011-12-05 Thread Szabo, Patrick (LNG-VIE)
Okay that toolbar is really useful and also looks kind of nice
J...Thanks for that. 

I've already found the problemsomehow my app triggers 800 queries
just for a simple page.

Can I somehow find out which part of my code is causing those queries ?!

 

patrick

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Nikolas
Stevenson-Molnar
Gesendet: Montag, 05. Dezember 2011 08:14
An: Nikolas Stevenson-Molnar
Cc: django-users@googlegroups.com
Betreff: Re: Performance

 

A bit more searching turned up something even better... looks like the
Django folks address this directly:
https://code.djangoproject.com/wiki/ProfilingDjango

 

_Nik

 

On Dec 4, 2011, at 11:03 PM, Nikolas Stevenson-Molnar wrote:





I haven't done this myself, but I would assume you could use the Python
profiler. Here's one project that facilitates profiling a WSGI app
(assuming you're using Django via WSGI): http://repoze.org/

 

Others here may have more experience with profiling web apps.

 

_Nik

 

On Dec 4, 2011, at 10:55 PM, Szabo, Patrick (LNG-VIE) wrote:





Hi,

 

In the last couple of weeks my app has become quite slowly and I'm
wondering why that is.

Are there any debugging tools where I can see what takes how much time ?

 

cheers

 

. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo
XSLT Developer

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: 00431 534521573

Fax: +43 (1) 534 52 - 146

 

 

 

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



AW: Performance

2011-12-05 Thread Szabo, Patrick (LNG-VIE)
Thx a lot i will check this out !

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Nikolas
Stevenson-Molnar
Gesendet: Montag, 05. Dezember 2011 08:14
An: Nikolas Stevenson-Molnar
Cc: django-users@googlegroups.com
Betreff: Re: Performance

 

A bit more searching turned up something even better... looks like the
Django folks address this directly:
https://code.djangoproject.com/wiki/ProfilingDjango

 

_Nik

 

On Dec 4, 2011, at 11:03 PM, Nikolas Stevenson-Molnar wrote:





I haven't done this myself, but I would assume you could use the Python
profiler. Here's one project that facilitates profiling a WSGI app
(assuming you're using Django via WSGI): http://repoze.org/

 

Others here may have more experience with profiling web apps.

 

_Nik

 

On Dec 4, 2011, at 10:55 PM, Szabo, Patrick (LNG-VIE) wrote:





Hi,

 

In the last couple of weeks my app has become quite slowly and I'm
wondering why that is.

Are there any debugging tools where I can see what takes how much time ?

 

cheers

 

. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo
XSLT Developer

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: 00431 534521573

Fax: +43 (1) 534 52 - 146

 

 

 

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



Performance

2011-12-04 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

In the last couple of weeks my app has become quite slowly and I'm
wondering why that is. 

Are there any debugging tools where I can see what takes how much time ?

 

cheers


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



AW: controlling user access

2011-11-17 Thread Szabo, Patrick (LNG-VIE)
To Clarify...you dont really need to make diffrent authentifications you
just have to make a clever query ;-)=

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Szabo, Patrick
(LNG-VIE)
Gesendet: Donnerstag, 17. November 2011 09:41
An: django-users@googlegroups.com
Betreff: AW: controlling user access

 

Hi, 

 

Well if i understand you correctly it doesnt sound so hard. 

Every user can have one or more businesses and every artikel can have on
business. 

So you just query for all articles where the business matches one of the
businesses the user belongs to. 

 

Hope that helps

 

Patrick

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Mario Gudelj
Gesendet: Donnerstag, 17. November 2011 09:14
An: django-users@googlegroups.com
Betreff: controlling user access

 

Hi Djangoers,

 

I have a problem on my hands I'm not sure how to approach and would
appreciate your guidance.

 

I'm building a site that will host articles for separate businesses and
each business will have a user who needs to log in and administer
article that only belong to a particular business.

 

So, I have the following model:

 

class Business(models.Model):

id = models.AutoField(primary_key=True)

name = models.CharField("Business Name", max_length=50, blank=False)

slug = models.SlugField("Slug", max_length=255, unique=True,
blank=False)



 

class StaffProfile(models.Model):

user = models.ForeignKey(User, unique=True)



id = models.AutoField(primary_key=True)



business = models.ManyToManyField(Business)

 

 

class Article(models.Model):

id = models.AutoField(primary_key=True)

business = models.ForeignKey(Business, null=False)



 

So, every business will have a separate subdomain and will have a unique
slug. 

 

Users can belong to one or more businesses and my StaffProfile extends
the Django's user class.

 

What I don't know is how to authenticate a user into a particular
business, so that this user only has access to the business they are
logged into.

 

What I want them to do is to choose which business they want to log into
on the login and once they enter the username, password and select the
business I want them to be able to access articles that only belong to
that business and none of the articles that belong to those other
businesses.

 

Any help or suggestions will be highly appreciated. Thanks guys!

 

Mario 

 

 

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

. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo
XSLT Developer 

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: 00431 534521573 

Fax: +43 (1) 534 52 - 146 

 

 

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



AW: controlling user access

2011-11-17 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

Well if i understand you correctly it doesnt sound so hard. 

Every user can have one or more businesses and every artikel can have on
business. 

So you just query for all articles where the business matches one of the
businesses the user belongs to. 

 

Hope that helps

 

Patrick

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Mario Gudelj
Gesendet: Donnerstag, 17. November 2011 09:14
An: django-users@googlegroups.com
Betreff: controlling user access

 

Hi Djangoers,

 

I have a problem on my hands I'm not sure how to approach and would
appreciate your guidance.

 

I'm building a site that will host articles for separate businesses and
each business will have a user who needs to log in and administer
article that only belong to a particular business.

 

So, I have the following model:

 

class Business(models.Model):

id = models.AutoField(primary_key=True)

name = models.CharField("Business Name", max_length=50, blank=False)

slug = models.SlugField("Slug", max_length=255, unique=True,
blank=False)



 

class StaffProfile(models.Model):

user = models.ForeignKey(User, unique=True)



id = models.AutoField(primary_key=True)



business = models.ManyToManyField(Business)

 

 

class Article(models.Model):

id = models.AutoField(primary_key=True)

business = models.ForeignKey(Business, null=False)



 

So, every business will have a separate subdomain and will have a unique
slug. 

 

Users can belong to one or more businesses and my StaffProfile extends
the Django's user class.

 

What I don't know is how to authenticate a user into a particular
business, so that this user only has access to the business they are
logged into.

 

What I want them to do is to choose which business they want to log into
on the login and once they enter the username, password and select the
business I want them to be able to access articles that only belong to
that business and none of the articles that belong to those other
businesses.

 

Any help or suggestions will be highly appreciated. Thanks guys!

 

Mario 

 

 

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



weird behavoir of Excel

2011-10-06 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I'm creating an EXCEL-Sheet out of Django with the following code:

 

response = render_to_response('reportsexcel.html', {'produkte':
dict(buch_pool), 'gesamt_string':gesamt_string}
,context_instance=RequestContext(request))

filename = "report.xls"

response['Content-Disposition'] = 'attachment; filename='+filename

response['Content-Type'] = 'application/vnd.ms-excel; charset=utf-8'

 

This works fine for the most part but there is a strange behaviour that
i don't understand. 

On the webpage i have a table that looks like this:

 

Produkt   10:20

Produkt2 04:30

 

Now in EXCEL this becomes

 

Produkt   10:20:00

Produkt2 04:30

 

This behaviour appears to be completely random.

 

Does anyone have an idea on how to controll this !?

 

I could create the sheet completly manual with xlwt but that seems a lot
of coding for such a small task.

 

cheers


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



AW: New user login problem

2011-09-16 Thread Szabo, Patrick (LNG-VIE)
Are you sure you've used the right credentials ?!
Can you log as the admin ?!
If so try to create another user and log in as such.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von marios
Gesendet: Freitag, 16. September 2011 13:14
An: Django users
Betreff: New user login problem

I am a new user of Django with not much experience in programming. I
am following the tutorial.
In the Administration module I have created a new user with some
permissions, but when I try to logging in as this new user appear an
error message ("Wrong user or password")
Could you help me?

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



AW: How To send arguments Along with Calling an .Html page

2011-09-01 Thread Szabo, Patrick (LNG-VIE)
I'm unsure in which direction you want to go so I'm just wrinting for both:

Fom view to template:

I think there are several ways but this is the one I'm using:

return render_to_response('index.html', {'user' : request.user, 
 'form' : f, 
 'latestEntries' : 
booksSorted[0:5], 
 'toDateEntries': booksToDate, 
 'calendar': mark_safe(cal), },  
 
context_instance=RequestContext(request))

In the template you will be able to acces user, form, 

Template to view:

You either post the values or use the URL to pass them on. 
If you post them you can acces request.Post in the view, which will give you a 
dict that contains the values. 
If you use the URL you have to configure urls.py adequate. (covered in the doc, 
sry i dont have the time right now to explain this further)

Hope this helps...


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Showket Bhat
Gesendet: Donnerstag, 01. September 2011 12:38
An: Django users
Betreff: How To send arguments Along with Calling an .Html page

Hi All..

I have created a button which i am using to delete the selected rows
from my table. How ever i want to use an image also for each row to
delete it.. but i am unable to use. i have used a submit button which
is working to delete entries how ever my anchor tag dosen't work coz i
am not sending any key or argument or Id of the row which i want to
delete.. Please Help me How can I delete and how can i send an
argument or id of that particular row with anchor Tag...

Thanks Here is my Code

Template.html
===







SNo.
Name
Price
Quantity
Exp. Date
Description




{% for single in medecine_obj%}


{{single.id}}
{{single.name}}
{{single.price}}
{{single.exp_date}}
{{single.discription}}


{%endfor%}






views.py
===

def delete_medecine(request,medecine={}):
print "="
del_ids = request.POST.getlist('del_id')
Medecine.objects.filter(id__in = del_ids).delete()

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



AW: custom templatetag that checks groups

2011-09-01 Thread Szabo, Patrick (LNG-VIE)
Okay i got it:

 

from django import template

register = template.Library()

 

@register.filter(name ="check")

def check(user, arg):

if str(user.groups.all()[0]) == "Timesheet-Boss":

return True

else:

return False

 

 

thanks anyways !

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Szabo, Patrick
(LNG-VIE)
Gesendet: Donnerstag, 01. September 2011 11:39
An: django-users@googlegroups.com
Betreff: custom templatetag that checks groups

 

Hi, 

 

I want to create my own templatetag that returns true if a user is
member of a certain group.

I did the following:

 

Created a package "templatetags" in my app. 

Wrote a module: 

 

from django import template

register = template.Library()

 

def check(user):

if str(user.groups.all()[0]) == "Timesheet-Boss":

return True

else:

return False

 

Put this in my html:

 

{% load checkers %}

 

{{ check:user  }}

 

I get the following error: 

 

Invalid filter: 'check'

Request Method:

GET

Request URL:

http://localhost:8000/

Django Version:

1.2.4

Exception Type:

TemplateSyntaxError

Exception Value:

Invalid filter: 'check'

 

 

What am i doing wrong ?!

 

Best regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



custom templatetag that checks groups

2011-09-01 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I want to create my own templatetag that returns true if a user is
member of a certain group.

I did the following:

 

Created a package "templatetags" in my app. 

Wrote a module: 

 

from django import template

register = template.Library()

 

def check(user):

if str(user.groups.all()[0]) == "Timesheet-Boss":

return True

else:

return False

 

Put this in my html:

 

{% load checkers %}

 

{{ check:user  }}

 

I get the following error: 

 

Invalid filter: 'check'

Request Method:

GET

Request URL:

http://localhost:8000/

Django Version:

1.2.4

Exception Type:

TemplateSyntaxError

Exception Value:

Invalid filter: 'check'

 

 

What am i doing wrong ?!

 

Best regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



AW: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Szabo, Patrick (LNG-VIE)
Glad it works now :-)


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Showket Bhat
Gesendet: Montag, 25. Juli 2011 14:45
An: Django users
Betreff: Re: __init__() got an unexpected keyword argument 'city'

Thankyou Sir, At last I did it.. U know I was having de problem with
form name and class name..I thought these both shuld be same.. I
changed The Form name to student_form and my problem was solved...
After few days... O Thank God... may Almighty Give u long
life..Thanks a lot once again

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



AW: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Szabo, Patrick (LNG-VIE)
I guess you question is how you tell the view to use your template right ?!
Im not a pro myself but here is how i understand it:

You need to return a rendered response in your view.
Now you can directly refer to your template like this:

return direct_to_template(request,'xxx.html')

or if you need to pass parameters to your template u can do this:

return render_to_response('xxx.html', {'para1': value,} 
,context_instance=RequestContext(request))

I'm not sure if you need the context_instance part though.



. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Showket Bhat
Gesendet: Montag, 25. Juli 2011 14:21
An: Django users
Betreff: Re: __init__() got an unexpected keyword argument 'city'

Yes U are right.. Now sir how would i link the template with view.py..
Inface i am doing what i am reading from my python book )definitive
Guide).. but I think I am trying to do hurry... is it ?

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



AW: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Szabo, Patrick (LNG-VIE)
Plz post the code of your model, form and view so we can take a look at it. 


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Showket Bhat
Gesendet: Montag, 25. Juli 2011 12:54
An: Django users
Betreff: Re: __init__() got an unexpected keyword argument 'city'

thanks again for ur assistance... I appreciate.. Thankyou

Sir, I did some changes and now i am able to store data in database
with out using forms however i wrote whole form designing code
in .html file, but when i am trying to use forms it gives __init()
error..the same one..Please Say something


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.



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



AW: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Szabo, Patrick (LNG-VIE)
I think you should complete the tutorial here: 
https://docs.djangoproject.com/en/1.3/intro/tutorial01/ 
It gives you a good overview of what django does and how. 
A big part of what youre trying to accomplish is already covered in this 
tutorial so it might be all you need :-)


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Showket Bhat
Gesendet: Montag, 25. Juli 2011 12:21
An: Django users
Betreff: Re: __init__() got an unexpected keyword argument 'city'

Thanks a lot for ur kind reply..

Well i am new to python and Django, It all went over my head..Meta
Keyword, ModelForm and Espatially the flow, Please if u can send me
some code or any manual where from i can create a simple web page with
a form and then some functionality to add data in my postgres database

Thankyou

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



AW: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Szabo, Patrick (LNG-VIE)
Hi, 

So you want a form to store a news student in your DB right ?!
If that's correct you also have a Model for the Student so you could simply use 
a ModelForm instead of a Form.

Example:

class Buchung(models.Model):
Mitarbeiter = models.IntegerField(max_length=3)
Produkt = models.ForeignKey(Produkte)
Datum = models.DateField()
Aktivitaet = models.ForeignKey(Aktivitaeten, blank=True)
Minuten = models.PositiveIntegerField(max_length=2)

class BuchungChangeForm(ModelForm):
class Meta:
model = Buchung

BuchungChangeForm should now be a form that has all the fields for Buchung.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Showket Bhat
Gesendet: Montag, 25. Juli 2011 10:23
An: Django users
Betreff: __init__() got an unexpected keyword argument 'city'

Hi I am facing this problim from few days..tried a lot to correct it
but everytime i failed..Please Help...

I have created a simple form to store few field values in my
database.. It was working until i used the forms.py.. when i developed
this with forms.py i got this error

__init__() got an unexpected keyword argument 'city'

Now i removed the forms.py but it still shows the same error.. But i
want to learn forms so how could i correct it ..Thanks in advance

===
forms.py
===

from django import forms

class Student(forms.Form):
roll_no = forms.IntegerField(required = False)
name = forms.CharField(max_length=20)
address =
forms.EmailField(required=False ,widget=forms.Textarea,label='Residential
address')
city = forms.CharField(required=False)
country = forms.CharField(max_length=50)
sex = forms.CharField(max_length=50)
classes_id = forms.IntegerField(required = False)
subject = forms.EmailField(required = False)
print ""


==
views.py
==

django.http import HttpResponse
from django.shortcuts import render_to_response
from school.student.models import *
from django import forms
from school.student.forms import *



def new_form(request):
#form = Student(request.GET)
##form = Student()
#form = Student(
#initial={'address': 'Pune, Maharashtra \n411048!',
'city' : 'Pune'}
#)

return render_to_response('student_form.html')


def inserted(request):
if 'name' in request.GET:
print "",request.GET
#form = ContactForm(request.GET)
roll_no = request.GET['roll_no']
name = request.GET['name']
city = request.GET['city']
country = request.GET['country']
classes_id = request.GET['classes_id']
print "+++",request.GET
sex = request.GET["sex"]

save_record = Student(roll_no = roll_no, name = name, city =
city , sex = sex, country=country, classes_id = classes_id)
print "00---"
save_record
save_record.save()
print save_record.id
return render_to_response('student_form.html',
{'student' :save_record.id})

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



AW: unable to show headline

2011-07-18 Thread Szabo, Patrick (LNG-VIE)
Take a look at the sourcecode of the html.

Maybe it's there but has a weird style or if it's not there at all you
might want to show us what's actually in "My_Model_Name.Attribute1"

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von bahare hoseini
Gesendet: Montag, 18. Juli 2011 10:49
An: django-users@googlegroups.com
Betreff: unable to show headline

 

hi,

i used  this code: {{ My_Model_Name.Attribute1 }} in my html
page. when i open this page with browser, mentioned HEADER isn't
visible, but rest of things(buttons, texts, ...) is visible,

 

can anybody help me plz?

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



AW: Delete a record

2011-07-18 Thread Szabo, Patrick (LNG-VIE)
Do you mean actually deleting an entry  in the db

 

https://docs.djangoproject.com/en/dev/topics/db/queries/#topics-db-queri
es-delete 

 

or removing (not showing) it from the form that is shown in html:

 

https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-s
ubset-of-fields-on-the-form 

 

hope this helps...

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von bahare hoseini
Gesendet: Montag, 18. Juli 2011 10:43
An: django-users@googlegroups.com
Betreff: Delete a record

 

hi there,

does someone know how i can delete a record from my form, i'm using
SQLite3 ? 

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.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



AW: AW: admin_media_prefix in page source is wrong

2011-07-18 Thread Szabo, Patrick (LNG-VIE)
Maybe I'm still not getting it but I think what you want to set is 
admin_media_url instead of admin_media_prefix.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Bram Deprettere
Gesendet: Montag, 18. Juli 2011 09:36
An: django-users@googlegroups.com
Betreff: Re: AW: admin_media_prefix in page source is wrong

I mean I used ln -ls to make a link to 
../../lib/python2.7/site-packages/django/contrib/admin/static/admin 
inside my static-folder.




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



AW: creating a simple mailbox

2011-07-15 Thread Szabo, Patrick (LNG-VIE)
Maybe one of those is something for you
http://djangopackages.com/grids/g/email/ 



. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von bh.hoseini
Gesendet: Freitag, 15. Juli 2011 11:04
An: Django users
Betreff: Re: creating a simple mailbox

yes i've recently done that (to make project easier i'm covering
"inbox" part first), what should i do next?
that's very kind of you, thanks

On Jul 14, 1:35 pm, ikatanda  wrote:
> have you created your views and added the url to point to the app
> mailbox page?
>
> On Jul 14, 7:36 am, bahare hoseini  wrote:
>
>
>
> > hi there,
> > as my first project i'm going to create a simple mail box to recieve or
> > delete Emails,
> > i made my models in my application, could you please tell me the next steps?
>
> > thanks.- Hide quoted text -
>
> - Show quoted text -

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



AW: Django: forms and custom templates

2011-07-15 Thread Szabo, Patrick (LNG-VIE)
I'm not sure if i understood your problem a 100 percent so i'll just write what 
i think you want ^^

>From what i understand i think you can use the code that has already been 
>written. Of course you might want to edit it a little bit for it to comply 
>with the other templates. 

If you want to work with the data from the forms, you'll have to pass the forms 
data (whatever is inputet or selected) to a view (per urls.py) and then do what 
you need to do with the data there. 



. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von samuele.mattiuzzo
Gesendet: Freitag, 15. Juli 2011 09:43
An: Django users
Betreff: Django: forms and custom templates

basic problem: i need to create real customized templates for my
django forms. That's it. I'm used to style the forms based on django's
output. This time is different, the html/css template is already done
(months before i was hired) and i cannot modify it, so i need django
to output exactly that html code.

I've read a lot throu django docs, and i found a lot, but i have to
admit, i couldn't put bits and pieces togheter, with order, to do what
i need to do.

Now, with CheckboxSelectMultiple the html output is this:


   
   ...


What i actually need to do is create something like
CustomCheckboxSelectMultiple to output exactly this template:


...
...


And so on for other types of form widgets. It's the only way i can
think of to create my forms with that particular layout they gave me.

I'm actually stuck on this, i cannot seem to be able to put everything
togheter to start coding my forms.
How can i manage this? If you have any example too, it will be great!
Otherwise, just point me towards the right direction please... sadly,
looking in the docs, as i said before, didn't actually help me

Thanks all in advance!


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



AW: admin_media_prefix in page source is wrong

2011-07-15 Thread Szabo, Patrick (LNG-VIE)
I'm sorry maybe this is a dumb question but what do you mean when you say

" Inside static-folder I made a link 
to ../../lib/python2.7/site-packages/django/contrib/admin/static/admin 
for the admin-media files."

?!


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Bram Deprettere
Gesendet: Freitag, 15. Juli 2011 09:11
An: django-users@googlegroups.com
Betreff: admin_media_prefix in page source is wrong

I'm having the following situation;
django project named inventory
Made a folder static for media-files. Inside static-folder I made a link 
to ../../lib/python2.7/site-packages/django/contrib/admin/static/admin 
for the admin-media files.

When I go to http://inventory/admin, the static/admin files are not 
loaded - so the page is shown without formatting.

When I check the page source, it shows 
admin_media_prefix="http://inventory/admin/"; instead of
http://inventory/static/admin/ as set in settings.py.

I'm using django 1.4 in a virtual env, nginx as frontend. When I go to 
http://inventory/static/admin it shows the css,... so that is configured 
correctly.



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



AW: Managing objects spred among several tables/databases.

2011-07-14 Thread Szabo, Patrick (LNG-VIE)
Hi, 

Are those tables somehow related to each other per FK ?!
In that case i think you might be able to use a model form for that purpose. 

I'm not really good with django myself so i might be talking bs.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Hummingbird
Gesendet: Donnerstag, 14. Juli 2011 15:01
An: Django users
Betreff: Re: Managing objects spred among several tables/databases.

Hi again !
I went through the docs of django again, but still could not find what
I was looking for.

Definition of my problem (simplified version to keep this post short):

Table names (field names) are are under--

customer (custid, custname, groupid),
custdetl (custid, address, tel, mobile, city)
group  (groupid, groupname)

There is a single form for handling tables "customer" and "custdetl".
Consider that a user wants to edit customer details in this form.

He changes groupid,
deletes phone number,
changes address,
adds city (earlier, it was left blank by user).

In effect, "customer" table should receive an update statement,
"custdetl" table should receive delete, update & insert statements.

Beforehand, we do not have any means to know what all interactions the
user will make.

My question is:--
Is there any generic way to do this in django?
OR
Is there any third party class (which can be imported in django)
available for catering to such a need?

( I googled to find 2 such classes.
1) "PyBackend" http://pybackend.sourceforge.net/,
2) "Modeling" by Sébastien Bigaret http://modeling.sourceforge.net/main.html
)

But these projects are not active and therefore are not supported.
Also some issues are there in installing them.

Can anybody pl. help?
Thanks.


On Jul 9, 8:53 am, Hummingbird  wrote:
> Although I have gone through the docs of Django ORM, let me re-read
> it.
> Then I will come back to this thread with specific question.
>
> Thanks for your reply.
>
> On Jul 8, 8:57 pm, Tom Evans  wrote:
>
>
>
> > On Fri, Jul 8, 2011 at 4:01 PM, Hummingbird  
> > wrote:
> > > @Cal,
> > > My apologies if my post has hurted you.
> > > I didn't mean that.
> > > I understand that all these open source projects are run by people who
> > > don't get paid for it.
>
> > > My point was quite different. It was about knowledge sharing.
> > > We can re-phrase the question if nobody understands what we mean to
> > > ask.
> > > Actually, we are not asking for any exact code or any spoon-feeding.
> > > We are asking whether anybody has developed a solution similar to
> > > CursorAdaptor in VFP
> > > Ed Leafe & Paul McNett have done marvelous work in this area (DABO
> > > desktop framework).
>
> > > Instead of making this post very long by giving details of what is a
> > > CursorAdaptor, pl. refer to --
> > >http://msdn.microsoft.com/en-us/library/d993hde7(v=vs.80).aspx
>
> > > Regarding your remark of "Don't expect an instant answer"--
> > > -- OP was dated 30th June.
> > > Today is 8th July (an instant???)
>
> > > Again, pl. excuse me if I have said anything wrong.
> > > @qMax:  Have you got any way around your question?
>
> > > ---Vineet
>
> > Hi Vineet
>
> > The problem both you and the OP have is that you asked extremely vague
> > questions. I've re-read the OPs post a number of times, and all I can
> > see is some extremely vague discussion on how the ORM represents
> > tables as model instances. I still don't see a question there, or at
> > least one I can answer.
>
> > Your question is only vaguely related to the OPs (in that it deals
> > with the ORM). On mailing lists, some people find replying to another
> > thread with a different question of your own almost as rude as TYPING
> > IN ALL CAPS. It is best to start a new thread rather than hijacking
> > someone elses. Secondly, continually bumping a thread each day is also
> > very annoying. Both of these things will dissuade people from replying
> > to you, so bear that in mind.
>
> > Netiquette apart, your question is vague. You describe a system where
> > by you can update various tables, updating the ones you want. This is
> > a basic feature of ORMs - have you read the tutorial or any of the
> > documentation on django's ORM?
>
> > I think the basic point is that you are far too vague about what you
> > want. You can't just point at us at some MS relational layer
> > documentation from 2005 and expect us to wade through it, work out
> > what you are currently doing, work out if that is applicable to
> > Django's ORM and formulate a plan for you. You are going to need to do
> > some of the work yourself.
>
> > There are more ORMs out there than you can imagine. You need to work
> > out what you want from a framework, and evaluate the frameworks out
> > there to find the suitable one for your 

AW: Trouble overriding registration templates

2011-07-12 Thread Szabo, Patrick (LNG-VIE)
Did you write your own view for that purpose ?!

In that view you could use render_to_response and pass you own template
to that.

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Joshua Russo
Gesendet: Mittwoch, 13. Juli 2011 04:24
An: django-users@googlegroups.com
Betreff: Trouble overriding registration templates

 

I want to use my own logout template but it doesn't want to pick it up.
The login template worked just fine, but for anything that's already in
the admin's template/registration folder, it only wants to use those. I
tried putting my templates folder before the admin templates folder in
the list of template folder in the settings file but that didn't do
anything. Any suggestions? 

-- 
You received this message because you are subscribed to the Google
Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/VcsTSOx1iSoJ.
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.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



AW: change values in "select list"

2011-07-04 Thread Szabo, Patrick (LNG-VIE)
Yeah, i know i'm a little messys with all that but thanks for the tipp. 

Could it be that you're Mail reader did something to the indentation because i 
am calling return inside the function or am i understanding you wrong ?!


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Andre Terra
Gesendet: Montag, 04. Juli 2011 16:00
An: django-users@googlegroups.com
Betreff: Re: change values in "select list"

Don't take it personally, but while we're at it, I should tell you
that Classes have CamelCase names and functions are
lowercase_with_underscores. Try not to mix both unless you have an
incredibly compelling reason (which is not the case here).

For what it's worth, it will do you good to name everything in
English, even if it's not your native language. Python's keywords are
in English (if, while, for, class, return, break...) and sticking to
one language makes the code easier to maintain (you might have a
developer on your team who doesn't speak German) and readable for
those of us who can only speak a language or two.


Cheers,
Andre Terra

On 7/4/11, Andre Terra  wrote:
> Hi, Patrick.
>
> Here are a couple of hints that will hopefully guide you in the right
> direction.
>
> It seems you are calling return from your class definition, when it is
> actually supposed to be used in a function.
>
> What happened to the label_from_instance function? Where it is supposed to
> go?
>
> I'll leave it to you to put two and two together. Consider it homework =)
>
>
> Cheers,
> André Terra
>
> On 7/4/11, Szabo, Patrick (LNG-VIE)  wrote:
>> Okay i think i'm close but i can't figure it out.
>> I did this:
>>
>> class ReportingForm_ProduktField(ModelChoiceField):
>> def label_from_instance(self, obj):
>> return "My Object #%i" % obj.id
>>
>>
>> class ReportingForm_Produkt(ModelForm):
>> Produkt = ReportingForm_ProduktField(Produkte.objects.all())
>> class Meta:
>> model = Buchung
>>
>> I've also tried this:
>>
>> class ReportingForm_Produkt(ModelForm):
>> Produkt = forms.ModelChoiceField(ReportingForm_ProduktField,
>> Produkte.objects.all())
>> class Meta:
>> model = Buchung
>>
>> Could you plz tell me if i'm even close to the solution or maybe even
>> give
>> me a hint on what I'm doing wrong
>>
>> Sry but this is rly urgent
>>
>>
>> . . . . . . . . . . . . . . . . . . . . . . . . . .
>> Patrick Szabo
>>  XSLT Developer
>> LexisNexis
>> Marxergasse 25, 1030 Wien
>>
>> mailto:patrick.sz...@lexisnexis.at
>> Tel.: 00431 534521573
>> Fax: +43 (1) 534 52 - 146
>>
>>
>> -Ursprüngliche Nachricht-
>>
>> Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
>> Im
>> Auftrag von Tom Evans
>> Gesendet: Montag, 04. Juli 2011 13:10
>> An: django-users@googlegroups.com
>> Betreff: Re: change values in "select list"
>>
>> On Mon, Jul 4, 2011 at 11:46 AM, Szabo, Patrick (LNG-VIE)
>>  wrote:
>>> I was afraid somethig like that would come.
>>> I did read the doc but i don't really understand it :-(
>>> Could you plz make it a little clearer for me  ?!
>>>
>>
>> You are using a model form. The model form has a model selection in
>> it. You want the select to have different labels.
>>
>> Labels on a model selection field come from the __unicode__ method of
>> the model, or from the label_from_instance of the model field class.
>>
>> Model forms allow you to specify the classes to use for each model
>> attribute.
>>
>> Hence:
>>
>> Define a new class derived from ModelChoiceField (not called
>> ModelChoiceField).
>> Add a label_from_instance method to the new class
>> Configure your ModelForm to use this new field instead of
>> ModelChoiceField
>>
>> All of this is explained in the docs. Read the docs.
>>
>> Tom
>>
>> --
>> 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 

AW: change values in "select list"

2011-07-04 Thread Szabo, Patrick (LNG-VIE)
Thanks for not giving up on me :-), i'll give it a try !


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Andre Terra
Gesendet: Montag, 04. Juli 2011 15:52
An: django-users@googlegroups.com
Betreff: Re: change values in "select list"

Hi, Patrick.

Here are a couple of hints that will hopefully guide you in the right direction.

It seems you are calling return from your class definition, when it is
actually supposed to be used in a function.

What happened to the label_from_instance function? Where it is supposed to go?

I'll leave it to you to put two and two together. Consider it homework =)


Cheers,
André Terra

On 7/4/11, Szabo, Patrick (LNG-VIE)  wrote:
> Okay i think i'm close but i can't figure it out.
> I did this:
>
> class ReportingForm_ProduktField(ModelChoiceField):
> def label_from_instance(self, obj):
> return "My Object #%i" % obj.id
>
>
> class ReportingForm_Produkt(ModelForm):
> Produkt = ReportingForm_ProduktField(Produkte.objects.all())
> class Meta:
> model = Buchung
>
> I've also tried this:
>
> class ReportingForm_Produkt(ModelForm):
> Produkt = forms.ModelChoiceField(ReportingForm_ProduktField,
> Produkte.objects.all())
> class Meta:
> model = Buchung
>
> Could you plz tell me if i'm even close to the solution or maybe even give
> me a hint on what I'm doing wrong
>
> Sry but this is rly urgent
>
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
> Patrick Szabo
>  XSLT Developer
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.sz...@lexisnexis.at
> Tel.: 00431 534521573
> Fax: +43 (1) 534 52 - 146
>
>
> -Ursprüngliche Nachricht-
>
> Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im
> Auftrag von Tom Evans
> Gesendet: Montag, 04. Juli 2011 13:10
> An: django-users@googlegroups.com
> Betreff: Re: change values in "select list"
>
> On Mon, Jul 4, 2011 at 11:46 AM, Szabo, Patrick (LNG-VIE)
>  wrote:
>> I was afraid somethig like that would come.
>> I did read the doc but i don't really understand it :-(
>> Could you plz make it a little clearer for me  ?!
>>
>
> You are using a model form. The model form has a model selection in
> it. You want the select to have different labels.
>
> Labels on a model selection field come from the __unicode__ method of
> the model, or from the label_from_instance of the model field class.
>
> Model forms allow you to specify the classes to use for each model
> attribute.
>
> Hence:
>
> Define a new class derived from ModelChoiceField (not called
> ModelChoiceField).
> Add a label_from_instance method to the new class
> Configure your ModelForm to use this new field instead of ModelChoiceField
>
> All of this is explained in the docs. Read the docs.
>
> Tom
>
> --
> 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.
>
>

-- 
Sent from my mobile device

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



AW: change values in "select list"

2011-07-04 Thread Szabo, Patrick (LNG-VIE)
Okay i think i'm close but i can't figure it out.
I did this:

class ReportingForm_ProduktField(ModelChoiceField):
def label_from_instance(self, obj):
return "My Object #%i" % obj.id   


class ReportingForm_Produkt(ModelForm):
Produkt = ReportingForm_ProduktField(Produkte.objects.all())
class Meta:
model = Buchung

I've also tried this:

class ReportingForm_Produkt(ModelForm):
Produkt = forms.ModelChoiceField(ReportingForm_ProduktField, 
Produkte.objects.all())
class Meta:
model = Buchung

Could you plz tell me if i'm even close to the solution or maybe even give me a 
hint on what I'm doing wrong

Sry but this is rly urgent


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Tom Evans
Gesendet: Montag, 04. Juli 2011 13:10
An: django-users@googlegroups.com
Betreff: Re: change values in "select list"

On Mon, Jul 4, 2011 at 11:46 AM, Szabo, Patrick (LNG-VIE)
 wrote:
> I was afraid somethig like that would come.
> I did read the doc but i don't really understand it :-(
> Could you plz make it a little clearer for me  ?!
>

You are using a model form. The model form has a model selection in
it. You want the select to have different labels.

Labels on a model selection field come from the __unicode__ method of
the model, or from the label_from_instance of the model field class.

Model forms allow you to specify the classes to use for each model attribute.

Hence:

Define a new class derived from ModelChoiceField (not called ModelChoiceField).
Add a label_from_instance method to the new class
Configure your ModelForm to use this new field instead of ModelChoiceField

All of this is explained in the docs. Read the docs.

Tom

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



AW: change values in "select list"

2011-07-04 Thread Szabo, Patrick (LNG-VIE)
Okay I'll try do tot hat...thank's a lot.
I already have this in my model for "Produkte" which holds the FK for that drop 
down:

def __unicode__(self):
if self.Auflage:
return "%s %s" % (self.Titel, self.Auflage)
else:
return self.Titel

So shouldn't this alreay be enough ?!


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Tom Evans
Gesendet: Montag, 04. Juli 2011 13:10
An: django-users@googlegroups.com
Betreff: Re: change values in "select list"

On Mon, Jul 4, 2011 at 11:46 AM, Szabo, Patrick (LNG-VIE)
 wrote:
> I was afraid somethig like that would come.
> I did read the doc but i don't really understand it :-(
> Could you plz make it a little clearer for me  ?!
>

You are using a model form. The model form has a model selection in
it. You want the select to have different labels.

Labels on a model selection field come from the __unicode__ method of
the model, or from the label_from_instance of the model field class.

Model forms allow you to specify the classes to use for each model attribute.

Hence:

Define a new class derived from ModelChoiceField (not called ModelChoiceField).
Add a label_from_instance method to the new class
Configure your ModelForm to use this new field instead of ModelChoiceField

All of this is explained in the docs. Read the docs.

Tom

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



AW: change values in "select list"

2011-07-04 Thread Szabo, Patrick (LNG-VIE)
I was afraid somethig like that would come. 
I did read the doc but i don't really understand it :-(
Could you plz make it a little clearer for me  ?!


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Tom Evans
Gesendet: Montag, 04. Juli 2011 12:43
An: django-users@googlegroups.com
Betreff: Re: change values in "select list"

On Mon, Jul 4, 2011 at 11:34 AM, Szabo, Patrick (LNG-VIE)
 wrote:
> Okay my Model now looks like this:
>
> ...
>
> but that didn't really change anything :-(
>

That is because you didn't read the documentation I linked you to, and
just tried copy/pasting some code into arbitrary places and then
complain.

Cargo cult programming never ends well. Re-read the documentation, try
to understand what it is telling you, and try again.

Cheers

Tom

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



AW: change values in "select list"

2011-07-04 Thread Szabo, Patrick (LNG-VIE)
Okay my Model now looks like this:

class Produkte(models.Model):
Kategorie = models.ForeignKey(Kategorien)
Titel = models.CharField(max_length=100)
Auflage = models.IntegerField(max_length=2, default=0)
Bestell_Nr = models.CharField(max_length=30, blank=True)
ISBN = models.CharField(max_length=30, blank=True)
Autor = models.CharField(max_length=50, blank=True)
Status = models.IntegerField(max_length=1, blank=False, default=1)

def __unicode__(self):
if self.Auflage:
return "%s %s" % (self.Titel, self.Auflage)
else:
return self.Titel

class Meta:
db_table = 'tb_Produkte'
verbose_name_plural = "Produkte"
verbose_name = "Produkt"
unique_together = ("Kategorie", "Titel", "Auflage", "Status")

class ModelChoiceField(ModelChoiceField):
def label_from_instance(self, obj):
return "%s%i" % obj.Titel, obj.Auflage

but that didn't really change anything :-(


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Tom Evans
Gesendet: Montag, 04. Juli 2011 12:19
An: django-users@googlegroups.com
Betreff: Re: change values in "select list"

On Mon, Jul 4, 2011 at 11:12 AM, Szabo, Patrick (LNG-VIE)
 wrote:
> Hi,
>
>
>
> I have a forum that looks like this:
>
>
>
> class ReportingForm_Produkt(ModelForm):
>
> class Meta:
>
> model = Buchung
>
>
>
> Where Buchung and Produkt looks like this:
>
>
>
> class Buchung(models.Model):
>
> Mitarbeiter = models.IntegerField(max_length=3)
>
> Produkt = models.ForeignKey(Produkte)
>
> Datum = models.DateField()
>
> Aktivitaet = models.ForeignKey(Aktivitaeten, blank=True)
>
> Minuten = models.PositiveIntegerField(max_length=2)
>
>
>
> def __unicode__(self):
>
> return str(self.Mitarbeiter) + ' ' + str(self.Datum)
>
>
>
> class Meta:
>
> db_table = 'tb_Times'
>
> verbose_name_plural = "Buchungen"
>
> verbose_name = "Buchung"
>
>
>
> class Produkte(models.Model):
>
> Kategorie = models.ForeignKey(Kategorien)
>
> Titel = models.CharField(max_length=100)
>
> Auflage = models.IntegerField(max_length=2, default=0)
>
> Bestell_Nr = models.CharField(max_length=30, blank=True)
>
> ISBN = models.CharField(max_length=30, blank=True)
>
> Autor = models.CharField(max_length=50, blank=True)
>
> Status = models.IntegerField(max_length=1, blank=False, default=1)
>
>
>
> def __unicode__(self):
>
> if self.Auflage:
>
> return "%s %s" % (self.Titel, self.Auflage)
>
> else:
>
> return self.Titel
>
>
>
> class Meta:
>
> db_table = 'tb_Produkte'
>
> verbose_name_plural = "Produkte"
>
> verbose_name = "Produkt"
>
> unique_together = ("Kategorie", "Titel", "Auflage", "Status")
>
>
>
> Now if i include that form into a template, the dropdown only shows the
> "Titel" of each objects from "Produkte".  I also want the "Auflage" - Info
> to be visible in the drop down.
>
>
>
> How do i do that ?!
>
>
>
> greetings
>


https://docs.djangoproject.com/en/1.3/ref/forms/fields/#modelchoicefield

"""
The __unicode__ method of the model will be called to generate string
representations of the objects for use in the field's choices; to
provide customized representations, subclass ModelChoiceField and
override label_from_instance.
"""

Cheers

Tom

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



change values in "select list"

2011-07-04 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I have a forum that looks like this:

 

class ReportingForm_Produkt(ModelForm):

class Meta:

model = Buchung

 

Where Buchung and Produkt looks like this:

 

class Buchung(models.Model):

Mitarbeiter = models.IntegerField(max_length=3)

Produkt = models.ForeignKey(Produkte)

Datum = models.DateField()

Aktivitaet = models.ForeignKey(Aktivitaeten, blank=True)

Minuten = models.PositiveIntegerField(max_length=2)

 

def __unicode__(self):

return str(self.Mitarbeiter) + ' ' + str(self.Datum)



class Meta:

db_table = 'tb_Times'

verbose_name_plural = "Buchungen"

verbose_name = "Buchung"

 

class Produkte(models.Model):

Kategorie = models.ForeignKey(Kategorien)

Titel = models.CharField(max_length=100)

Auflage = models.IntegerField(max_length=2, default=0)

Bestell_Nr = models.CharField(max_length=30, blank=True)

ISBN = models.CharField(max_length=30, blank=True)

Autor = models.CharField(max_length=50, blank=True)

Status = models.IntegerField(max_length=1, blank=False, default=1)



def __unicode__(self):

if self.Auflage:

return "%s %s" % (self.Titel, self.Auflage)

else:

return self.Titel



class Meta:

db_table = 'tb_Produkte'

verbose_name_plural = "Produkte"

verbose_name = "Produkt"

unique_together = ("Kategorie", "Titel", "Auflage", "Status")

 

Now if i include that form into a template, the dropdown only shows the
"Titel" of each objects from "Produkte".  I also want the "Auflage" -
Info to be visible in the drop down.

 

How do i do that ?!

 

greetings


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



AW: unique_together doesn't work

2011-07-04 Thread Szabo, Patrick (LNG-VIE)
Thank you all for your help. 
For now i just removed the "ALLOW NULL" on the fields and placed default values.

I have another question but ill post this in a new "thread" because it's not 
related.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Tom Evans
Gesendet: Montag, 04. Juli 2011 11:53
An: django-users@googlegroups.com
Betreff: Re: unique_together doesn't work

On Mon, Jul 4, 2011 at 10:43 AM, Szabo, Patrick (LNG-VIE)
 wrote:
> Hi,
>
> Sry, i was a little bit unclear.
> Of course i tried to store identical entries (all fields have the same 
> values) and i had no problem doing so.  Since most of the files i want to 
> check for can be null i only inputet a titel.
>
>

It might have been nice for you to give this example straight up
(although you haven't actually specified the case clearly, I'm still
just guessing).

So you are creating objects, and 3 of the fields that you have said
are unique_together are undefined, and have Null=True in their field
definition? In databases, NULL is not equal to anything, even NULL.
Eg, NULL == NULL is false.

Therefore, 2 rows in the database with the same title, but with NULL
for the other 3 fields in the unique index, would not be considered as
the same row.

Tom

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



AW: AW: unique_together doesn't work

2011-07-04 Thread Szabo, Patrick (LNG-VIE)
Yes i am. 
It seems that in the fieldset there can not be a field that is allowed to be 
null. 
If i remove that field it works.

Is there a workaround for that ?!


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Kenneth Gonsalves
Gesendet: Montag, 04. Juli 2011 11:48
An: django-users@googlegroups.com
Betreff: Re: AW: unique_together doesn't work

On Mon, 2011-07-04 at 11:43 +0200, Szabo, Patrick (LNG-VIE) wrote:
> Sry, i was a little bit unclear. 
> Of course i tried to store identical entries (all fields have the same
> values) and i had no problem doing so.  Since most of the files i want
> to check for can be null i only inputet a titel. 

are you using mysql?
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.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.



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



AW: unique_together doesn't work

2011-07-04 Thread Szabo, Patrick (LNG-VIE)
Well like i sad (i guess i did) i can still storey entries that are not unique


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Kenneth Gonsalves
Gesendet: Montag, 04. Juli 2011 11:40
An: django-users@googlegroups.com
Betreff: Re: unique_together doesn't work

On Mon, 2011-07-04 at 11:33 +0200, Szabo, Patrick (LNG-VIE) wrote:
> but somehow the unique_together doesn't seem to work.

what does 'doesn't seem to work' mean?
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.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.



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



AW: unique_together doesn't work

2011-07-04 Thread Szabo, Patrick (LNG-VIE)
Hi, 

Sry, i was a little bit unclear. 
Of course i tried to store identical entries (all fields have the same values) 
and i had no problem doing so.  Since most of the files i want to check for can 
be null i only inputet a titel.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Tom Evans
Gesendet: Montag, 04. Juli 2011 11:38
An: django-users@googlegroups.com
Betreff: Re: unique_together doesn't work

On Mon, Jul 4, 2011 at 10:33 AM, Szabo, Patrick (LNG-VIE)
 wrote:
> Hi,
> ...
> class Meta:
> unique_together = ("Kategorie", "Titel", "Auflage", "Status")
>
> but somehow the unique_together doesn't seem to work. I can store entries
> with the same titel without a problem.
>
>
>
> Am I doing something wrong ?!
>

That's not what unique_*together* means - you can't have two entries
with the same category, title, condition and status. Eg you can have
two entries with the same title, as long as they have different
category, condition or status.

Cheers

Tom

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



unique_together doesn't work

2011-07-04 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I have the following model: 

 

class Produkte(models.Model):

Kategorie = models.ForeignKey(Kategorien)

Titel = models.CharField(max_length=100)

Auflage = models.IntegerField(max_length=2, blank=True)

Bestell_Nr = models.CharField(max_length=30, blank=True)

ISBN = models.CharField(max_length=30, blank=True)

Autor = models.CharField(max_length=50, blank=True)

Status = models.IntegerField(max_length=1, blank=False, default=1)



def __unicode__(self):

if self.Auflage:

return "%s %s" % (self.Titel, self.Auflage)

else:

return self.Titel



class Meta:

db_table = 'tb_Produkte'

verbose_name_plural = "Produkte"

verbose_name = "Produkt"

unique_together = ("Kategorie", "Titel", "Auflage", "Status")

 

but somehow the unique_together doesn't seem to work. I can store
entries with the same titel without a problem. 

 

Am I doing something wrong ?!

 

greets


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



AW: Advice needed: more advanced user capability

2011-05-20 Thread Szabo, Patrick (LNG-VIE)
Maybe you should take look at this:

https://django-userena.org/

The role- and profile- thing could be realized via the normal groups in django.

pat


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von BobX
Gesendet: Freitag, 20. Mai 2011 11:49
An: Django users
Betreff: Advice needed: more advanced user capability

Got a question about my Django development that I'd appreciate some
sage "best practices" advice on.

My Django app needs more user capability than is available in the
default middleware. Specificially I need to be able to:
o "age" passwords;
o do checks on validity of new passwords - make sure they're not
reused, are greater than a minimum length and are "strong";
o lock out accounts after a certain number of failed attempts;
o have a capability like the "roles" or "profiles" one - so user A
needs to be able to just view data, user B needs to be able to
acknowledge login warning messages and reset locked users, user C
needs to have full access to user admin features, etc.

I figure that the best way to do this is to use the sessions features
in Django, but avoid the in-built user capability. I'm more than happy
to generate all the screens and code that are needed, but I obviously
don't want to do that if there's a simpler/better way. For obvious
reasons I really don't want to end up patching/extending the Django
code (and then have to redo my changes when Django 1.4 comes out).

Thanks.

Bob

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



AW: unpredictable CSRF error on mobile devices

2011-05-10 Thread Szabo, Patrick (LNG-VIE)
Maybe they should try to log in simulatneously with the same user while one 
uses his iPhone and the other one a PC.
If the error still occurs you know it's not about the devices but about using 
the same user or same wifi-network. 

cheers


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von nederhoed
Gesendet: Dienstag, 10. Mai 2011 12:46
An: Django users
Betreff: Re: unpredictable CSRF error on mobile devices

Is it possible for a user to receive the CSRF error when he logs in
using two almost identical iPhones, from the same Wifi network, with
the same username, simultaneously?

I would think these 2 sessions wouldn't collide...

Cheers, Robert-Reinder

On May 9, 11:06 am, nederhoed  wrote:
> Hi everyone,
>
> just a few users of our website get an CSRF error when trying to log
> on using a mobile device. This behavior only occurs with about 3 out
> of 150 users. We have 2 colleagues with the same device (iPhone) of
> which one of the two has this problem. The other hasn't.
> The user can login using a desktop PC...
>
> What could be an explanation?
>
> We have applied all the csrf inclusions (Middleware, RequestContext,
> csrf tag in POST forms), yet some users can't log in and get the ugly
> CSRF error on their mobile.
>
> Our website runs Django 1.2.1:http://im.knmp.nl/
>
> Fragment form settings.py
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.middleware.doc.XViewMiddleware',
> )
>
> Any help would be highly appreciated.
>
> Kind regards, Robert-Reinder
> --

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



AW: outer joins, raw sql or one-to-many?

2011-05-10 Thread Szabo, Patrick (LNG-VIE)
The latter might not work for your specific model but in general it works. 
I'm using this synax in quite a few cases.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Michel30
Gesendet: Dienstag, 10. Mai 2011 09:48
An: Django users
Betreff: Re: outer joins, raw sql or one-to-many?

wow this works :-)

I think I mixed up the tables before:

submitter = models.ForeignKey(Author, db_column='SubmitterID')
vs
submitter = models.ForeignKey(Author, db_column='authorid')

the latter doesn't work obviously..

Thanks all, I think this will help me on my way!

On May 10, 9:38 am, "Szabo, Patrick \(LNG-VIE\)"
 wrote:
> The lather should work...
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
> Patrick Szabo
>  XSLT Developer
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.sz...@lexisnexis.at
> Tel.: +43 (1) 534 52 - 1573
> Fax: +43 (1) 534 52 - 146
>
> -Ursprüngliche Nachricht-
>
> Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
> Auftrag von Kenneth Gonsalves
> Gesendet: Dienstag, 10. Mai 2011 09:34
> An: django-users@googlegroups.com
> Betreff: Re: outer joins, raw sql or one-to-many?
>
> On Tue, 2011-05-10 at 00:26 -0700, Michel30 wrote:
> > {{ some_thing.firstname }}
>
> maybe
> {{ some_thing.submitter.firstname }}
> --
> regards
> KGhttp://lawgon.livejournal.com
> Coimbatore LUG roxhttp://ilugcbe.techstud.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.



AW: outer joins, raw sql or one-to-many?

2011-05-10 Thread Szabo, Patrick (LNG-VIE)
The lather should work...


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Kenneth Gonsalves
Gesendet: Dienstag, 10. Mai 2011 09:34
An: django-users@googlegroups.com
Betreff: Re: outer joins, raw sql or one-to-many?

On Tue, 2011-05-10 at 00:26 -0700, Michel30 wrote:
> {{ some_thing.firstname }}

maybe
{{ some_thing.submitter.firstname }}
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.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.



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



AW: Problem in Configuring the database

2011-05-06 Thread Szabo, Patrick (LNG-VIE)
Hi, 

Well, are u using a MySQL database or sqilite ?!
Of course that's what it depends on wether to use mysql oder sqlite driver.
Mabe you could give us a little more information about your DB

cheers


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von r_bloodlife
Gesendet: Freitag, 06. Mai 2011 10:16
An: Django users
Betreff: Problem in Configuring the database

Hello,
I'm a beginner trying to build an application..
please help in correcting these errors..
I'm Confused, whether to use "MySql" or "Sqllite3"


"rahul@linux-cgdq:~/myproject/prj> ls -l
total 36
-rw-r--r-- 1 rahul users  148 2011-05-04 23:36 current_datetime.py
-rw-r--r-- 1 rahul users0 2011-05-04 22:52 __init__.py
-rw-r--r-- 1 rahul users  131 2011-05-04 22:53 __init__.pyc
-rw-r--r-- 1 rahul users  503 2011-05-04 22:52 manage.py
-rw-r--r-- 1 rahul users 5040 2011-05-06 13:33 settings.py
-rw-r--r-- 1 rahul users 2798 2011-05-04 23:29 settings.pyc
-rw-r--r-- 1 rahul users  555 2011-05-04 23:35 urls.py
-rw-r--r-- 1 rahul users  278 2011-05-04 22:53 urls.pyc
-rw-r--r-- 1 rahul users  209 2011-05-04 23:31 views.py
rahul@linux-cgdq:~/myproject/prj> python manage.py runserver
Validating models...

Unhandled exception in thread started by >
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/django/core/management/
commands/runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
  File "/usr/local/lib/python2.6/site-packages/django/core/management/
base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
  File "/usr/local/lib/python2.6/site-packages/django/core/management/
validation.py", line 103, in get_validation_errors
connection.validation.validate_field(e, opts, f)
  File "/usr/local/lib/python2.6/site-packages/django/db/backends/
mysql/validation.py", line 14, in validate_field
db_version = self.connection.get_server_version()
  File "/usr/local/lib/python2.6/site-packages/django/db/backends/
mysql/base.py", line 338, in get_server_version
self.cursor()
  File "/usr/local/lib/python2.6/site-packages/django/db/backends/
__init__.py", line 252, in cursor
cursor = util.CursorWrapper(self._cursor(), self)
  File "/usr/local/lib/python2.6/site-packages/django/db/backends/
mysql/base.py", line 322, in _cursor
self.connection = Database.connect(**kwargs)
  File "/usr/lib/python2.6/site-packages/MySQLdb/__init__.py", line
71, in Connect
return Connection(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/MySQLdb/connections.py", line
170, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2002, "Can't connect to local
MySQL server through socket '/var/run/mysql/mysql.sock' (2)")

"

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



AW: problems: python manage.py syncdb

2011-04-22 Thread Szabo, Patrick (LNG-VIE)
Try to connect to the DB with a „real“ client and see i fit works at all.

The webserver (manage.py runserver) does not need to be running when you call 
syncdb.

 

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von ???
Gesendet: Freitag, 22. April 2011 13:57
An: django-users@googlegroups.com
Betreff: Re: problems: python manage.py syncdb

 

Hi:

I think you configuration for database(postgresql) is not correct , or your 
database is not running, make sure you can connect your database using you 
profile on settings,py

2011/4/22 Lancinè I KABA 

Hello!!!
I am new to django, and am running the tutorial.  I have edited
'settings.py' and am running "python manage.py runserver".

When I run the server and then call "python manage.py syncdb" against
my Postgres database, everything just hangs.

If I kill 'runserver', then I get this message from syncdb:

site-packages/Django-1.3-py2.4.egg/django/db/backends/
postgresql_psycopg2/base.py
line 140

self.connection = Database.connect(**conn_params)
psycopg2.OperationalError: could not connect to server:  Connection
refused

When I turn the server back on and run syncdb, it just hangs.  I try
turning on verbose and other options...but I see nothing.

It seems like something is talking to the server, but that is as far

KABA
Student in Le Mans, France


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


 Original Message 

Subject: problems: python manage.py syncdb
Date: Fri, 22 Apr 2011 10:17:05 +0200
From: 
To: 

Bonjour,

C'est pour demander de l'aide pour ce problème.

Avec la commande python manage.py syncdb ou python manage.py sql ou
python manage.py sqlall on a plusieurs ligne de d'erreur dont:

self.connection = database.connect(**conn_params)
psycopg2.OperationalError: could not connect to server: Connection
refused (0*274D/10061)

Ci joint la copie d'ecran de l'erreur


Merci de m'aider

KABA
Etudiant Le Mans, France

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




-- 
Thanks & Regards,
ezioruan = {
'email':'qiaoqinq...@gamil.com 
 ',
'interests':{ 'Python',  'Linux' 'game'},
'location':'南京',
'website':'http://ezioandnanjing.appspot.com/',
'note':'功名利禄身外物,知足常乐总逍遥'
}

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



AW: filtering drop downs according to logged in user

2011-04-22 Thread Szabo, Patrick (LNG-VIE)
Okay i got it...

Thanks a lot !


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Szabo, Patrick (LNG-VIE)
Gesendet: Freitag, 22. April 2011 09:10
An: django-users@googlegroups.com
Betreff: AW: filtering drop downs according to logged in user

Hi, 

I like that idea.
I have a problem with implementing it.

I got the following code:

f = BuchungForm(initial= {'Datum': heute, 'Stunden': 0, 'Minuten': 0,})
choices = Aktivitaeten.objects.all()
f.fields['Aktivitaet'].choices = choices

I used all() just for testing of couse i'll filter later.

I get "Caught TypeError while rendering: 'Aktivitaeten' object is not iterable"

Am i doing something wrong ?!

Kind regards



. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Dan Gentry
Gesendet: Donnerstag, 21. April 2011 21:05
An: Django users
Betreff: Re: filtering drop downs according to logged in user

I have set the choices list in the view:

choices =
SomeModel.objects.filter(user=request.user).values_list('id','label')

Then, after the form is instantiated, modify the choices attribute of
the ChoiceField:

form = SomeOtherModelForm()
form.fields['model_dropdown'].choices = choices

Works in a similar fashion with a ModelChoiceField and the queryset
attribute.

On Apr 21, 10:10 am, "Szabo, Patrick \(LNG-VIE\)"
 wrote:
> Hi,
>
> I want to filter the dropdownlists that are automatically used to select
> a foreign-key in forms (in my views).
>
> Normally that could easily be done with "class Meta" in the Modelform.
>
> Thing is i want to filter by an attribute of the current
> userspecificly the groups that the user is assigned to.
>
> So how do i do that ?!
>
> Can i acces request.user in the models somehow ?!
>
> Kind regards
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
> Patrick Szabo
>  XSLT Developer
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.sz...@lexisnexis.at
> Tel.: +43 (1) 534 52 - 1573
> Fax: +43 (1) 534 52 - 146

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



AW: filtering drop downs according to logged in user

2011-04-22 Thread Szabo, Patrick (LNG-VIE)
Hi, 

I like that idea.
I have a problem with implementing it.

I got the following code:

f = BuchungForm(initial= {'Datum': heute, 'Stunden': 0, 'Minuten': 0,})
choices = Aktivitaeten.objects.all()
f.fields['Aktivitaet'].choices = choices

I used all() just for testing of couse i'll filter later.

I get "Caught TypeError while rendering: 'Aktivitaeten' object is not iterable"

Am i doing something wrong ?!

Kind regards



. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Dan Gentry
Gesendet: Donnerstag, 21. April 2011 21:05
An: Django users
Betreff: Re: filtering drop downs according to logged in user

I have set the choices list in the view:

choices =
SomeModel.objects.filter(user=request.user).values_list('id','label')

Then, after the form is instantiated, modify the choices attribute of
the ChoiceField:

form = SomeOtherModelForm()
form.fields['model_dropdown'].choices = choices

Works in a similar fashion with a ModelChoiceField and the queryset
attribute.

On Apr 21, 10:10 am, "Szabo, Patrick \(LNG-VIE\)"
 wrote:
> Hi,
>
> I want to filter the dropdownlists that are automatically used to select
> a foreign-key in forms (in my views).
>
> Normally that could easily be done with "class Meta" in the Modelform.
>
> Thing is i want to filter by an attribute of the current
> userspecificly the groups that the user is assigned to.
>
> So how do i do that ?!
>
> Can i acces request.user in the models somehow ?!
>
> Kind regards
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
> Patrick Szabo
>  XSLT Developer
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.sz...@lexisnexis.at
> Tel.: +43 (1) 534 52 - 1573
> Fax: +43 (1) 534 52 - 146

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



AW: filtering drop downs according to logged in user

2011-04-21 Thread Szabo, Patrick (LNG-VIE)
Yeah, that is off topic but i'll answer it anyway ;-)

As you might have already guessed I'm developing XSLT and XSL-FO
Stylesheets.

Of course there are other things I do to create Workflows for
Content-production but those are my "main tools" 

Obviously I'm also developing with Python ^^

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Cal Leeming
[Simplicity Media Ltd]
Gesendet: Donnerstag, 21. April 2011 19:02
An: django-users@googlegroups.com
Betreff: Re: filtering drop downs according to logged in user

 

Completely off topic but, what exactly does an "XSLT Developer" do?

On Thu, Apr 21, 2011 at 3:10 PM, Szabo, Patrick (LNG-VIE)
 wrote:

Hi, 

 

I want to filter the dropdownlists that are automatically used to select
a foreign-key in forms (in my views).

Normally that could easily be done with "class Meta" in the Modelform.

Thing is i want to filter by an attribute of the current
userspecificly the groups that the user is assigned to.

 

So how do i do that ?!

Can i acces request.user in the models somehow ?!

 

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .

Patrick Szabo
XSLT Developer 

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: +43 (1) 534 52 - 1573 

Fax: +43 (1) 534 52 - 146 

 

 

-- 
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
<mailto:django-users%2bunsubscr...@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.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



filtering drop downs according to logged in user

2011-04-21 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I want to filter the dropdownlists that are automatically used to select
a foreign-key in forms (in my views).

Normally that could easily be done with "class Meta" in the Modelform.

Thing is i want to filter by an attribute of the current
userspecificly the groups that the user is assigned to.

 

So how do i do that ?!

Can i acces request.user in the models somehow ?!

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: queries gone wild

2011-04-20 Thread Szabo, Patrick (LNG-VIE)
Thanks, I'll give it a shot !

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Oleg Lomaka
Gesendet: Mittwoch, 20. April 2011 11:24
An: django-users@googlegroups.com
Betreff: Re: queries gone wild

 

Looks like you store dates as strings in sqlite and as dates in mysql.
Try this queryset:

 

Duchung.objeccts.filter(Mitarbeiter=request.user.id,
Datum__year=str(tag).split('-')[0])

 

On Wed, Apr 20, 2011 at 11:51 AM, Szabo, Patrick (LNG-VIE)
 wrote:

 

For developement i've used sqlite and now i want to transfer to mysql. 

The transfer itself worked fine but now a couple of queries don't work
anymore.

 

Example:

 

Buchung.objects.filter(Mitarbeiter = request.user.id,
Datum__startswith=str(tag).split('-')[0])

 

"tag" looks like 2011-04-20.

So I only want to get objects where "Datum" (Date) starts with 2011.
"Datum" looks just like "tag".

This worked fine with sqlite but now Im getting this error:

 

Incorrect date value: '2011%' for column 'Datum' at row 1

 

Does anyone know how to overcome this ?!

 

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



queries gone wild

2011-04-20 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

For developement i've used sqlite and now i want to transfer to mysql. 

The transfer itself worked fine but now a couple of queries don't work
anymore.

 

Example:

 

Buchung.objects.filter(Mitarbeiter = request.user.id,
Datum__startswith=str(tag).split('-')[0])

 

"tag" looks like 2011-04-20.

So I only want to get objects where "Datum" (Date) starts with 2011.
"Datum" looks just like "tag".

This worked fine with sqlite but now Im getting this error:

 

Incorrect date value: '2011%' for column 'Datum' at row 1

 

Does anyone know how to overcome this ?!

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



LDAP and 1.2

2011-04-05 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

has anyone sucessfully conncted their django 1.2 app with Active
Directory ?!

 

Which snippet did you use ?!

 

I'm concastantly getting  "Invalid credentials" Error -.-

 

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: form has not attribute cleaned_data

2011-03-28 Thread Szabo, Patrick (LNG-VIE)
Strange.
I'm new to python and django myself but im wondering how form.is_valid() works 
when form is only initiated a line later. 

Doesnt it have to look like this:

if request.user.is_superuser:
if request.method == 'POST':
form = Form_news(request.POST)
if form.is_valid():
 mess = form.cleaned_data['messgg']

?!



. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von luca72
Gesendet: Montag, 28. März 2011 15:05
An: Django users
Betreff: form has not attribute cleaned_data

hello i have a form like this:
class Form_news(forms.Form):
messgg = forms.CharField(label = 'Messaggio',max_length=1,
widget=forms.Textarea)

and in the views i do as follow:
if request.user.is_superuser:
if request.method == 'POST':
if form.is_valid():
 form = Form_news(request.POST)
 mess = form.cleaned_data['messgg']

i get the error form News has not attribute cleaned_data

Why?

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



AW: MEDIA_URL not treated like static

2011-03-28 Thread Szabo, Patrick (LNG-VIE)
I have a static folder in my Prject and my MEDIA_URL looks like this: 
http://127.0.0.1:8000/static/

 

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von galgal
Gesendet: Montag, 28. März 2011 13:38
An: django-users@googlegroups.com
Betreff: MEDIA_URL not treated like static

 

I have that dirs structure:

site_media/

|
---> static/

|

---> uploads/

 

static dir is set as STATIC_URL = '/site_media/static/'

uploads dir is set as MEDIA_URL = '/site_media/uploads/'

 

In that case on dev server (localhost:8000) media_url is not accessible via 
browser as static file, and whe I try to access it I get 404 error. How can i 
set it up to be seen as static?

In uploads dir are all files uploaded by users. static dir includes all my 
js/css/images

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: acces lists by index

2011-03-10 Thread Szabo, Patrick (LNG-VIE)
Nevermind:

 

This did it:

 

{% for x in akt %}

  {% if forloop.last %}

{{ x }}

  {% endif %}

{% endfor %}

 

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Szabo, Patrick (LNG-VIE)
Gesendet: Donnerstag, 10. März 2011 16:25
An: django-users@googlegroups.com
Betreff: acces lists by index

 

Hi, 

 

I'm trying to acces the last index of a list in my template but list[-1] throws 
 the following error:

 

Could not parse the remainder: '[-1]' from 'list[-1]'

 

How can i do it right !?

 

Kind regards

 

. . . . . . . . . . . . . . . . . . . . . . . . . .

Patrick Szabo
XSLT Developer 

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: +43 (1) 534 52 - 1573 

Fax: +43 (1) 534 52 - 146 

 

 

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



acces lists by index

2011-03-10 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I'm trying to acces the last index of a list in my template but list[-1]
throws  the following error:

 

Could not parse the remainder: '[-1]' from 'list[-1]'

 

How can i do it right !?

 

Kind regards

 


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: acces to dict

2011-03-10 Thread Szabo, Patrick (LNG-VIE)
Hi, 

Thx for the hint...works like a charme :-)

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Matias Aguirre
Gesendet: Donnerstag, 10. März 2011 14:42
An: django-users
Betreff: Re: acces to dict

Hi

The problem is that django template system tries __getkey__ first and as you
are using a defaultdict get key call is creating a new entry with key "items"
and empty list as value.

Try passing dict(prod_pool) to your template.

Regards,
Matías

Excerpts from Szabo, Patrick \(LNG-VIE\)'s message of Thu Mar 10 11:28:00 -0200 
2011:
> Hi, 
> 
>  
> 
> I'm passing a dict of lists on to a template like this:
> 
>  
> 
> return render_to_response('reports.html', {'produkte': prod_pool}
> ,context_instance=RequestContext(request))
> 
>  
> 
> prod_pool looks like this:
> 
>  
> 
> defaultdict(, {'Dumme G\xc3\xa4nge revisited':
> ['Absatzkontrolle'], 'Das Sparschwein im Wandel der Zeiten':
> ['Konvertierungsanleitung', 'Sonstiges'], 'Schlager 1':
> ['Konvertierungsanleitung'], 'RWZ 1': ['Absatzkontrolle',
> 'Konvertierungsanleitung'], 'RWZ 3': ['Absatzkontrolle',
> 'Konvertierungsanleitung']})
> 
>  
> 
> In my template i do this:
> 
>  
> 
> {% for produkt, akt in produkte.items %}
> 
> {{ produkt }}
> 
>  
> 
>
> 
>Aktivitaet
> 
>Zeit
> 
>
> 
>
> 
>{% for x in akt%}
> 
>{{ x }}
> 
>{% endfor %}
> 
>
> 
>
> 
>Gesamt: 
> 
> 
> 
>
> 
> 
> 
> {% endfor %}
> 
>  
> 
> Unfortunately i don't get a single table...
> 
> Can anyone help me ?!
> 
>  
> 
> Kind regards
-- 
Matías Aguirre 

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



acces to dict

2011-03-10 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I'm passing a dict of lists on to a template like this:

 

return render_to_response('reports.html', {'produkte': prod_pool}
,context_instance=RequestContext(request))

 

prod_pool looks like this:

 

defaultdict(, {'Dumme G\xc3\xa4nge revisited':
['Absatzkontrolle'], 'Das Sparschwein im Wandel der Zeiten':
['Konvertierungsanleitung', 'Sonstiges'], 'Schlager 1':
['Konvertierungsanleitung'], 'RWZ 1': ['Absatzkontrolle',
'Konvertierungsanleitung'], 'RWZ 3': ['Absatzkontrolle',
'Konvertierungsanleitung']})

 

In my template i do this:

 

{% for produkt, akt in produkte.items %}

{{ produkt }}

 

   

   Aktivitaet

   Zeit

   

   

   {% for x in akt%}

   {{ x }}

   {% endfor %}

   

   

   Gesamt: 



   



{% endfor %}

 

Unfortunately i don't get a single table...

Can anyone help me ?!

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



redirect and still pass dict

2011-03-09 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I want to redirect to a certains url, but still pass a dict like in
render_to_response...is that possible ?!

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: automated query if already exists

2011-03-09 Thread Szabo, Patrick (LNG-VIE)
Hi, 

So easy :-)

Thanks i just didn't think of that hat.

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Casey Greene
Gesendet: Mittwoch, 09. März 2011 14:12
An: django-users@googlegroups.com
Betreff: Re: automated query if already exists

Hi Patrick,

Does get not do what you want?

http://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-a-single-object-with-get

Hope this helps,
Casey

On 03/09/2011 08:03 AM, Szabo, Patrick (LNG-VIE) wrote:
> Hi,
>
> Since django is able to do so much so easy i was wandering if there was
> some kind of possibility to check if an entry with the same values
> already exists.
>
> I've tried unique_together but this only does the job on the database
> end and if i want to store an not unique object i get an error.
>
> I'd rather not show that error but return my own message.
>
> Is there a simpler way to do this thatn check alle the entries "manually"
>
> Kind regards
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
>
> **
>
> Patrick Szabo
> XSLT Developer
>
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> patrick.sz...@lexisnexis.at <mailto:patrick.sz...@lexisnexis.at>
>
> Tel.: +43 (1) 534 52 - 1573
>
> Fax: +43 (1) 534 52 - 146
>
>
>
> --
> 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.



automated query if already exists

2011-03-09 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

Since django is able to do so much so easy i was wandering if there was
some kind of possibility to check if an entry with the same values
already exists.

 

I've tried unique_together but this only does the job on the database
end and if i want to store an not unique object i get an error.

I'd rather not show that error but return my own message.

 

Is there a simpler way to do this thatn check alle the entries
"manually"

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



dependend fields

2011-03-08 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I want to make the choices of a dropdown menu dependend on what is
chosen from another field. 

One field is a normal Textfield and the other one is created by the
model.

 

What is the best and easiest way of doing that ?!

 

Kind regards

 


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: AW: parameter, but not in the URL

2011-03-04 Thread Szabo, Patrick (LNG-VIE)
Thats a good idea !

Thx 


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Shamail Tayyab
Gesendet: Freitag, 04. März 2011 11:59
An: django-users@googlegroups.com
Betreff: Re: AW: parameter, but not in the URL

On 04/03/11 4:08 PM, Eric Abrahamsen wrote:
> On Fri, Mar 04 2011, Szabo, Patrick (LNG-VIE) wrote:
>
>> Hi,
>>
>> Thanks for you fast response !
>>
>> I've already made sure that users can only edit or delete objects that
>> they've created but i thought it might be even better to hide those
>> information.
> If you put the delete link in a form "action", and have the delete view
> redirect to a different url when it's done, that's about as "hidden" as
> it gets. A determined user will still be able to figure out the pattern,
> but if they can only delete their own resoures, then why hide it?
>
>> Kind regards
>>
>>
>> . . . . . . . . . . . . . . . . . . . . . . . . . .
>> Patrick Szabo
>>   XSLT Developer
>> LexisNexis
>> Marxergasse 25, 1030 Wien
>>
>> mailto:patrick.sz...@lexisnexis.at
>> Tel.: +43 (1) 534 52 - 1573
>> Fax: +43 (1) 534 52 - 146
>>
>>
>> -Ursprüngliche Nachricht-
>>
>> Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
>> Auftrag von Eric Abrahamsen
>> Gesendet: Freitag, 04. März 2011 10:46
>> An: django-users@googlegroups.com
>> Betreff: Re: parameter, but not in the URL
>>
>> On Fri, Mar 04 2011, Szabo, Patrick (LNG-VIE) wrote:
>>
>>> 127.0.0.1:800/93/1
>>>
>>>
>>>
>>> This would delete an object with the id 93.
>>>
>>> This is very unsecure and once the user notices how this works he
>>> could delete any object he wants.
>>>
>>>
>>>
>>> How can i make this more secure ?!
>> There's pretty much always a public-facing URL that can be used to
>> delete a resource. I believe the best thing is just to require that a
>> user be logged in to perform the action. That's most simply done with a
>> @login_required decorator on the
>>
>> If you keep track of which users created which resources, you can
>> restrict them to only deleting resources they created with some simple
>> logic in the view.
>>
>> HTH,
>> Eric
>>
>> -- 
>> 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 don't you make the objects to be referred by a key rather than ID?

e.g

class Something (...):
eid = StringField(max_length=48)   # additional field.

Then while creating this object, you make this eid as:
import random as r
import hashlib
eid = hashlib.sha1 ( str(r.random()) + "MY_COOL_SALT" )

then you form your URLs like:
/33bac54baa...33b/delete

This won't make it 100% secure, but will make it almost impossible to 
guess an ID.

Tx

-- 
Shamail Tayyab
Blog: http://shamail.in/blog

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



AW: parameter, but not in the URL

2011-03-04 Thread Szabo, Patrick (LNG-VIE)
Hi, 

Thanks for you fast response !

I've already made sure that users can only edit or delete objects that they've 
created but i thought it might be even better to hide those information.

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Eric Abrahamsen
Gesendet: Freitag, 04. März 2011 10:46
An: django-users@googlegroups.com
Betreff: Re: parameter, but not in the URL

On Fri, Mar 04 2011, Szabo, Patrick (LNG-VIE) wrote:

> 127.0.0.1:800/93/1
>
>  
>
> This would delete an object with the id 93.
>
> This is very unsecure and once the user notices how this works he
> could delete any object he wants.
>
>  
>
> How can i make this more secure ?!

There's pretty much always a public-facing URL that can be used to
delete a resource. I believe the best thing is just to require that a
user be logged in to perform the action. That's most simply done with a
@login_required decorator on the

If you keep track of which users created which resources, you can
restrict them to only deleting resources they created with some simple
logic in the view.

HTH,
Eric

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



parameter, but not in the URL

2011-03-04 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

Currently i pass all my parameterst hat a views needs over the URL. 

Eg.

 

127.0.0.1:800/93/1

 

This would delete an object with the id 93.

This is very unsecure and once the user notices how this works he could
delete any object he wants.

 

How can i make this more secure ?!

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



JavaScript Parameter

2011-03-03 Thread Szabo, Patrick (LNG-VIE)
Hi, 

I finally found a JavaScript that gives me autosuggest functionality for
a textfield.
Unfortunately this script uses a hard-coded array for the suggestions
and of courese i want to use values from my database.

Any idea how i could pass the javascript an array that contains all my
values ?!

Im calling the script like this in my template: 

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: UnicodeDecodeError: 'ASCII' codec can't decode byte 0xe0 in position 0: ordinal not in range(128)

2011-03-03 Thread Szabo, Patrick (LNG-VIE)
If you want to see errors in the browser you might want to set "DEBUG = True" 
in your settings.py

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Vladimir
Gesendet: Donnerstag, 03. März 2011 10:01
An: Django users
Betreff: Re: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in 
position 0: ordinal not in range(128)

1. web browser does not give messages, in command line I see:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py",
line 280, in run
self.result=application(self.environ, self.start_response)
File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py",
line 709, in __call__
mime_type=mimetypes.guess_type(file_path)[0]
File "C:\Python27\lib\mimetypes.py", line 294, in guess_type
init()
File "C:\Python27\lib\mimetypes.py", line 355, in init
db.read_windows_registry()
File "C:\Python27\lib\mimetypes.py", line 259, in
read_windows_registry
for ctype in enum_types(mimedb):
File "C:\Python27\lib\mimetypes.py", line 249, in  enum_types
ctype=ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position
0: ordinal not in range(128)

2. mysite\blog\models.py:
# -*- coding: utf-8 -*-

from django.db import models
from django.contrib import admin

class BlogPost(models.Model):
title = models.CharField(max_length=150)
body = models.TextField()
timestamp = models.DateTimeField()

class Meta:
ordering = ('-timestamp',)

class BlogPostAdmin(admin.ModelAdmin):
list_display = ('title', 'timestamp')

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



AW: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal not in range(128)

2011-03-02 Thread Szabo, Patrick (LNG-VIE)
Good morning !

Unfortunately i cant help you with your problem because i have the same problem 
here ;)
I can however answer youre question if this is a common problem for django 
beginners.
I don't think it's common for django beginners, i'd rather say it's common for 
python beginners - like me ;)

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Vladimir
Gesendet: Donnerstag, 03. März 2011 07:48
An: Django users
Betreff: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 
0: ordinal not in range(128)

Good morning!
In me first exercise project with Django I met an error message:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position
0: ordinal not in range(128). Admin pages are built without css.
Then I changed all .py-files entering
# -*- coding: utf-8 -*-
into the first row and recreated database:
ALTER DATABASE `djangodb` DEFAULT CHARACTER SET utf-8 COLLATE
utf8_unicode_ci
I also tryed COLLATE utf8_swedish_ci. Then I recreated tables with
manage.py syncdb.
No effect. Is this a typical problem of Django beginners?
I need only russian and english languages in my projects endeed.

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



django and mod_wsgi

2011-02-28 Thread Szabo, Patrick (LNG-VIE)
I'm trying to get my django-app running on apache 2.2  on windows XP.

I've installed everything and the Hello Worlf wsgi ran fine. 

 

Now i wanted to run my django ap and did the following in a django.wsgi
:

 

import os

import sys

 

path = 'C:\\Programme\\Apache Software Foundation\\Time2\\Time2\\'

if path not in sys.path:

sys.path.append(path)

 

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' (I've tried to
replace mysite with the name of my app but that doesn't work either)

 

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

 

I get the following error:

 

[Mon Feb 28 13:11:06 2011] [error] [client 10.122.64.212] ImportError:
Could not import settings 'mysite.settings' (Is it on sys.path? Does it
have syntax errors?): No module named mysite.settings

 

My project is called Time2.

 

Like i said a test file from the wsig tutorial runs fine so wsgi should
be installed correctly. 

 

Can anyone help me ?!

 

Kind regards

 

 


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



autocomplete omg

2011-02-28 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I'm using the latest version of Django with sqlite and want to implement
autocomplete for one of my fields. 

I've tried 4 diffrent tutorials an non oft them works. 

 

Has anyone got a full tutorial for me that definetely  works with the
current version ?!

Maybe one youre using yourfelf ?!

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: combobox

2011-02-27 Thread Szabo, Patrick (LNG-VIE)
Thx, i'll give it a shot ;-)


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Marc DM
Gesendet: Freitag, 25. Februar 2011 19:36
An: Django users
Betreff: Re: combobox

On Feb 25, 11:18 am, "Szabo, Patrick \(LNG-VIE\)"
 wrote:
> Hi,
>
> I was trying to get "An AJAX Select Widget for Django"
> (http://code.djangoproject.com/wiki/AJAXWidgetComboBox) running but i
> found out that it doesn't work with newer versions of django (correct me
> if I'm wrong.)
>
> Is there an alternative or a way to make it work with the newest version
> ?!


If you're using jQuery, you could take a look at the combobox example
on the jQueryUI autocomplete page.

http://jqueryui.com/demos/autocomplete/#combobox

They use the autocomplete widget from jQueryUI and create a basic
combobox. The good thing is that the code is all right there and quite
easy to understand. So, if it doesn't do EXACTLY what you want, you
can modify it.

There seems to be no real consensus on how the combobox should work so
there are many incompatible versions out there. Try using the jQuery
one as a starting point and make what you want.

Just my $0.02


Marc DM
DjangoMuser

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



combobox

2011-02-25 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 


I was trying to get "An AJAX Select Widget for Django"
(http://code.djangoproject.com/wiki/AJAXWidgetComboBox ) running but i
found out that it doesn't work with newer versions of django (correct me
if I'm wrong.)


Is there an alternative or a way to make it work with the newest version
?!


 


Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



custom formfield submit

2011-02-23 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I have a form that - of course - creates new entry in my database. 

I created the form out of a model except for 1 field. 

 

Now if i click submit only the values of the fields that are created out
of the form are stored in the DB - also not suprising

What i want to to is take the value of the custom field and add it to
the value of one of the fields that where generated from the model. 

 

How do i do that ?!

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



Datefield

2011-02-16 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I built my own view where users can add new DB-entries. 

I have a DateField and generated the Form for it directly from the model
but i don't see this calender-icon like i do in the admin panel. 

How can I add it ?!

 

Is it enough to just reference to the .js in the template !? (doesn't
seem to work)

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



'str' object is not callable

2011-02-16 Thread Szabo, Patrick (LNG-VIE)
Hi, 

Im getting 'str' object is not callable and i have no idea why. 
What I'm doing is the following:

delete

buchung is a list and the 6th element oft hat list is an object with an
attribute id.

In my urls.py i did this:

(r'deletion_time/(?P\d+)/$', 'deletion_time'),

And the view looks like this:

def deletion_time(request, obj_id):
buchung = Buchung.object.filter(id = obj_id)
buchung.delete()
return HttpResponseRedirect('/main/')

Can anyone tell me what's causing this error ?!

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: list to template

2011-02-15 Thread Szabo, Patrick (LNG-VIE)
No of course it's not a joke...it really isn't
I guess i just missunderstood. 

But still {{ buchung.0.0 }} doesn't work either


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Tom Evans
Gesendet: Dienstag, 15. Februar 2011 16:05
An: django-users@googlegroups.com
Betreff: Re: list to template

On Tue, Feb 15, 2011 at 2:36 PM, Szabo, Patrick (LNG-VIE)
 wrote:
> According to youre link my synthax was correct:
>
>* Dictionary lookup. Example: foo["bar"]
>* Attribute lookup. Example: foo.bar
>* Method call. Example: foo.bar()
>* List-index lookup. Example: foo[bar]
>
> Anyway none of those work :-(
>

Is this in some way a joke? I'm not getting it.

>
> Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
> Auftrag von Tom Evans
> http://docs.djangoproject.com/en/1.2/ref/templates/api/#rendering-a-context
>
> Templates use '.' as a special lookup when used in a variable name.
> You can use a dot to do dictionary lookup, attribute lookup, method
> calls and list index lookup. What you are trying to do is the latter.
>
> The correct way of doing it is:
>
> {{ buchung.0.0 }}
>

I refer you to my original response and the linked documentation.

Tom

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



AW: list to template

2011-02-15 Thread Szabo, Patrick (LNG-VIE)
According to youre link my synthax was correct:

* Dictionary lookup. Example: foo["bar"]
* Attribute lookup. Example: foo.bar
* Method call. Example: foo.bar()
* List-index lookup. Example: foo[bar]

Anyway none of those work :-(


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Tom Evans
Gesendet: Dienstag, 15. Februar 2011 15:24
An: django-users@googlegroups.com
Betreff: Re: list to template

On Tue, Feb 15, 2011 at 2:09 PM, Szabo, Patrick (LNG-VIE)
 wrote:
> Hi,
>
> Now when i try to acces that lists with
>
> {{ buchung[0][0] }}
>

This isn't particularly well documented, best I could find is this:

http://docs.djangoproject.com/en/1.2/ref/templates/api/#rendering-a-context

Templates use '.' as a special lookup when used in a variable name.
You can use a dot to do dictionary lookup, attribute lookup, method
calls and list index lookup. What you are trying to do is the latter.

The correct way of doing it is:

{{ buchung.0.0 }}

Cheers

Tom

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



list to template

2011-02-15 Thread Szabo, Patrick (LNG-VIE)
 

Sry a part of my code was wrong i use

 

{%for buchung in result %}

{{ buchung[0][0] }}

{%endfor%}

 

To acces the list...

 

Von: Szabo, Patrick (LNG-VIE) 
Gesendet: Dienstag, 15. Februar 2011 15:09
An: 'django-users@googlegroups.com'
Betreff: list to template

 

Hi, 

 

What i want to do is show all DB-entries of a certain user.

These entries include foreign keys and i need to get the related objects
too and print them in a template

 

So what i do is this:

 

First i get all the objects that i need. 

 

buchungen = Buchung.objects.filter(Mitarbeiter = request.user.id)

 

then i want to make a list that stores lists where each of those lists
contains an object and the related objects: 

 

for buchung in buchungen:

books.append([buchung, buchung.Produkt, buchung.Aktivitaet])

 

and i pass it on to the template:

 

return render_to_response('main/index.html', {'user' : request.user,
'form' : f, 'result' : books}, context_instance=RequestContext(request))

 

Now when i try to acces that lists with

 

{{ buchung[0][0] }}

 

I get the following error:

 

Could not parse the remainder: '[0][0]' from 'buchung[0][0]'

 

How can i get acces tot hat lists ?!

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



list to template

2011-02-15 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

What i want to do is show all DB-entries of a certain user.

These entries include foreign keys and i need to get the related objects
too and print them in a template

 

So what i do is this:

 

First i get all the objects that i need. 

 

buchungen = Buchung.objects.filter(Mitarbeiter = request.user.id)

 

then i want to make a list that stores lists where each of those lists
contains an object and the related objects: 

 

for buchung in buchungen:

books.append([buchung, buchung.Produkt, buchung.Aktivitaet])

 

and i pass it on to the template:

 

return render_to_response('main/index.html', {'user' : request.user,
'form' : f, 'result' : books}, context_instance=RequestContext(request))

 

Now when i try to acces that lists with

 

{{ buchung[0][0] }}

 

I get the following error:

 

Could not parse the remainder: '[0][0]' from 'buchung[0][0]'

 

How can i get acces tot hat lists ?!

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: AW: images

2011-02-15 Thread Szabo, Patrick (LNG-VIE)
Now it works...Thanks a lot everybody !

. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: images

2011-02-15 Thread Szabo, Patrick (LNG-VIE)
How do i check the logs !?
I'm using the integrated webserver.

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Kenneth Gonsalves
Gesendet: Dienstag, 15. Februar 2011 11:05
An: django-users@googlegroups.com
Betreff: Re: images

On Tue, 2011-02-15 at 11:00 +0100, Szabo, Patrick (LNG-VIE) wrote:
> Unfortunately i only get the "alt text" shown and not the image. 
> The image is in the same directory as the template. 

check your logs to see where it is searching for your image
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.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.



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



images

2011-02-15 Thread Szabo, Patrick (LNG-VIE)
Hi, 

I just want an image to be shown in my header so i just added it in my
template like this:



Unfortunately i only get the "alt text" shown and not the image. 
The image is in the same directory as the template.

Why doesn't this work ?!

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: Having trouble synchronizing the database, can someone help?

2011-02-15 Thread Szabo, Patrick (LNG-VIE)
I think i rember reading in the doc that you can somehow run custom sql...is 
that an option ?!

 

If this is something you don’t have to do regularly you could also just connect 
to the db with some gui-client and delete the tables there

 

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Chen Xu
Gesendet: Dienstag, 15. Februar 2011 09:01
An: django-users@googlegroups.com
Betreff: Re: Having trouble synchronizing the database, can someone help?

 

thanks, flush does help, but it delete everything, however I have 2 apps in my 
db, so is there any commands (ex: sqlclear ) that allows me to only 
remove the tables in particular app??

Thanks

On Mon, Feb 14, 2011 at 11:51 PM, Szabo, Patrick (LNG-VIE) 
 wrote:

I think sqlflush just prints the SQL-Statement.

Flush will actually du the job

 

Hope that helps !

 

. . . . . . . . . . . . . . . . . . . . . . . . . .

Patrick Szabo
XSLT-Entwickler 

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: +43 (1) 534 52 - 1573 

Fax: +43 (1) 534 52 - 146 

 

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Chen Xu
Gesendet: Dienstag, 15. Februar 2011 08:45
An: django-users@googlegroups.com
Betreff: Re: Having trouble synchronizing the database, can someone help?

 

thanks very much everyone, but I just have one more small question.

I tried to use some python manage.py command to delete tables (ex: sqlflush, 
sqlreset),
but they all just print out the sql statement without doing the real job, so 
what is the command to do the actual removal of the tables?


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 
<mailto:django-users%2bunsubscr...@googlegroups.com> .
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




-- 
⚡ Chen Xu ⚡

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: Having trouble synchronizing the database, can someone help?

2011-02-14 Thread Szabo, Patrick (LNG-VIE)
I think sqlflush just prints the SQL-Statement.

Flush will actually du the job

 

Hope that helps !

 

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Chen Xu
Gesendet: Dienstag, 15. Februar 2011 08:45
An: django-users@googlegroups.com
Betreff: Re: Having trouble synchronizing the database, can someone help?

 

thanks very much everyone, but I just have one more small question.

I tried to use some python manage.py command to delete tables (ex: sqlflush, 
sqlreset),
but they all just print out the sql statement without doing the real job, so 
what is the command to do the actual removal of the tables?


Thanks

 


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



AW: AW: Form to add data

2011-02-14 Thread Szabo, Patrick (LNG-VIE)
okay your first linked helped me...thank you !
I guess the documentaion is just too fragmented for me. 

So now my view looks like this:

def main(request):
f = BuchungForm(request.POST)
return render_to_response('main/index.html', {'user' : request.user, 'form' 
: f})

and my template looks like this:

..
{% csrf_token %}
{{ form.as_p }}


...

This gives me almost the form that i wanted. 

Now i did exclude certain fields in my form because i have to set them 
automaticaly.
Eg. I have a field that's called Mitarbeiter. I want to set the field to the 
current user id so i've tried this:

def main(request):
f = BuchungForm(request.POST)
buchung = f.save(commit=False)
buchung.Mitarbeiter = 'request.user.id'
buchung.save()
return render_to_response('main/index.html', {'user' : request.user, 'form' 
: f})

but this gives me the following error:

could not be created because the data didn't validate.

It seems like as soon as i enter the site it tries co submit the data. Can i 
somehow stop that from hapening. ?!




. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Tom Evans
Gesendet: Montag, 14. Februar 2011 14:22
An: django-users@googlegroups.com
Betreff: Re: AW: Form to add data

How hard are you looking?

http://docs.djangoproject.com/en/1.2/topics/forms/

This page shows a clear example of how to use forms in general

http://docs.djangoproject.com/en/1.2/topics/forms/modelforms/

This page shows clear examples of how to use modelforms.

Cheers

Tom



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



AW: AW: Form to add data

2011-02-14 Thread Szabo, Patrick (LNG-VIE)
Ahh stupid mistake...okay no error anymore.
But i still dont see any field in my view :-(

How do show the form ?!

I guess i have to pass the form onto the template and then reference to it in 
the template ?!
If so, how do I do that ?!

I swear I'm reading the documentaion but i really can't find those information.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Michael
Gesendet: Montag, 14. Februar 2011 14:08
An: django-users@googlegroups.com
Betreff: Re: AW: Form to add data

You have to import AuthorForm into your views.py

from models import AuthorForm


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



AW: Form to add data

2011-02-14 Thread Szabo, Patrick (LNG-VIE)
Thanks, that is exactly what I've been reading for the past hours but i can't 
make it work.

>From what i understand:

I do this in my models.py

class AuthorForm(ModelForm):
class Meta:
model = Author

Where do i have to put this to

f = AuthorForm(request.POST) 

?!

My guess was in the view but that tells me that AuthorForm is not defined.

Could you give me a hint ?!

Kind regards


Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Daniel Roseman
Gesendet: Montag, 14. Februar 2011 13:49
An: django-users@googlegroups.com
Betreff: Re: Form to add data

On Monday, February 14, 2011 12:42:48 PM UTC, Szabo, Patrick (LNG-VIE) wrote:
Hi, 
How do i add a form to a template/view that let's me add a Databaseentry.
I also want to list all the entries from a certain table in on the same site.
Now I'm reading the documentaion and it says something about automaticly 
creating such forms from models but i can't figure out what exactly i have to 
do to make it work.

http://docs.djangoproject.com/en/1.2/topics/forms/modelforms/ 

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

. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



  1   2   >