Re: main page have stopped work after creating poll app

2018-05-28 Thread Florian Schweikert

It seems you don't have a "main" page.
The page you saw was a placeholder starting page if there are no other 
urls defined.

If you want to deliver something at / you have to add it to urls.py


PS: pasting screenshots of code is a very bad habit.

On 26/05/18 14:46, Dmitry Sobolev wrote:



if I comment this stroke in urls.py the main page begins to work but in 
this case I don't have an access to the polls app.





суббота, 26 мая 2018 г., 15:00:04 UTC+3 пользователь Dmitry Sobolev написал:

Hello guys!
I am doing 1st steps in Django.
Started 1st tutorial page 3 times from there and getting the same
case each time.
After that, I created a working "poll app" that works under
127.0.0.1:8000/polls/ 
the main address stop working
where should I see the problem of this problem and make main page
work both with "poll app"?
Thanks!

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4d392683-e5c3-40fc-98f6-7a0d91e8fa8b%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/632f534e-c43f-76ec-cca8-a39dc11ab489%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: Filter Json boolean data

2018-01-19 Thread Florian Schweikert
Hi,

On 19/01/18 11:50, tango ward wrote:
>     # Check who the winner of the match
>     if data['radiant_win'] == 'False':

You are comparing a boolean with the *string* 'False', remove the ' and
try again.

>     j_data['Winner'] = data['dire_name']
>     else:
>     j_data['Winner'] = data['radiant_name']
> 
>     # Put the data in our game_data list
>     game_data.append(j_data)

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/28f8e57a-2857-b5dc-c987-d4f378bb3247%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: pass context to overridden templates

2017-05-04 Thread Florian Schweikert
On 03/05/17 15:53, cjdcordeiro wrote:
> Probably the best would be overriding the app's default class based
> view, but when I look at it
> (https://github.com/django-notifications/django-notifications/blob/master/notifications/views.py#L29)
> it doesn't have a get_context method or anything I can play with to
> change the default context
> 
> ideas? anyone?

As NotificationViewList is a ListView it should have get_context_data
see:
https://docs.djangoproject.com/en/1.11/ref/class-based-views/generic-display/#listview

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/50149974-8169-8e3a-9b0f-8f0ed25624d7%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: No installed app with label 'province'.

2017-02-09 Thread Florian Schweikert
On 09/02/17 14:01, Gerald Brown wrote:
> Because of this problem I am NOT able to proceed with my project so any
> and all help will be appreciated.

Maybe somebody could help you if you provide more information about what
you are doing.

Following information could give some starting points for investigating
the problem:
* What does you INSTALLED_APPS look like?
* The code of your ModelAdmin wogether with where you trying to register
it. (including imports)
* Are your models working correctly? Did creating migrations and
applying them work?

--
regards,
Florian

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ef15bc9b-d61a-1c13-a394-ff4f1a5fd86d%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Reverse for 'reg/{{post.pk}}/' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

2016-05-30 Thread Florian Schweikert
On 24/05/16 08:46, meInvent bbird wrote:
>  onClick="window.location.href='{% url 'reg/{{post.pk}}'  %}'">Save

You cannot access a variable like this in a template.
There is also no point in trying to access an url using url providing an
url. Your url pattern is called 'post_detail'.

Try something like:
{% url 'post_detail' pk=post.pk %}

More information is available in the docs:
https://docs.djangoproject.com/en/1.9/ref/templates/builtins/#url

--
Florian

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/455b7782-d723-8bf0-0961-5e39f09ea55d%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: 1.8 or 1.9?

2016-05-12 Thread Florian Schweikert
On 12/05/16 18:36, Sean McKinley wrote:
> I haven't taken the course, but the differences between basic Django 1.8
> and 1.9 are not all that significant and you can find out if you are
> being taught something odd by reviewing 1.9 release notes. Big caveat,
> syncdb is gone in 1.9 so you have to learn migrations if the Udemy
> course is using syncdb.

syncdb was deprecated in 1.7, with release of the django migrations.
So basically the only difference may be using another command for the
same thing.
If there are no deprecation warnings using the app with 1.8 it should be
no problem to upgrade to 1.9.
The main difference between 1.8 and 1.9 in my opinion is support.
1.8 is LTS and will be supported longer than 1.9, we still build all new
applications for our customers with 1.8 at work because of the longer
support.
Most of the features of 1.9 are possible to install as python package,
like the new admin theme and PermissionMixins/django-braces

Upgrading a minor version is mostly easy and a good thing to learn ;)

--
Florian

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/434a09da-3db4-fc5a-e75a-615d7eb97ea3%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: NAS using Django

2016-03-10 Thread Florian Schweikert
On 10/03/16 08:03, Vayuj Rajan wrote:
> I configured SAMBA and I can access it directly at my computer. But what
> I saw there that he was accessing it by using a  website . So basically
> he was accessing it from local web server with a storage attached.

You basically want something like owncloud[1] if I get you right.

> So, I wanted to connect my Django web application with Samba File
> sharing sever so that I can access it from an IP typed at a web-browser.

If Django running on the NAS, there is no need to use smb.

--
Florian

[1] https://owncloud.org/

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56E14438.1030102%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Absolute beginner question -- recipes

2016-02-29 Thread Florian Schweikert
On 28/02/16 20:14, Simon Gunacker wrote:
> |
> def detail(request, pk):
> recipe = Recipe.objects.get(id=pk)
> recipe['steps'] = Steps.objects.filter(recipe_id=pk)
> template = loader.get_template('recipe/recipe_detail.html')
> context = {
> 'recipe': recipe,
> }
> return HttpResponse(template.render(context,request))
> |

OT:
Have a look at the render shortcut:
https://docs.djangoproject.com/en/1.9/topics/http/shortcuts/#render

| return render(request, 'recipe/recipe_detail.html', context)

Maybe you can simply use a generic DetailView:
https://docs.djangoproject.com/es/1.9/ref/class-based-views/generic-display/#detailview

--
Florian

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56D44106.1070704%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: like query django

2016-01-19 Thread Florian Schweikert
On 19/01/16 16:35, Xristos Xristoou wrote:
> url(r'^view/(?P[^\.]+)/$', views.view_post, name='view_post'),
> url(r'^(?P[0−9]+)/$', views.like_post, name='like_post'),

this defines urls like /1/

> The current URL, |like/1/|, didn't match any of these.

of course it doesn't, you didn't define a like/... url pattern

--
Florian

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/569E5F25.50500%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: n00b question about displaying data in order by day

2015-11-07 Thread Florian Schweikert
On 07/11/15 06:03, Becka R. wrote:
> How can I display the data in the template so the shifts are sorted by
> day, and then by meal?

Try saving the weekday as integer (0-6), sorting using integer is much
easier than sorting using strings in non-alphabetic order :)
You can than e.g. define a default ordering for your model:
https://docs.djangoproject.com/en/1.8/ref/models/options/#ordering
or sort it in the view:
https://docs.djangoproject.com/en/1.8/ref/models/querysets/#django.db.models.query.QuerySet.order_by

--
Florian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/563E7D3B.3060407%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Admin: Unknown fields

2015-09-29 Thread Florian Schweikert
On 29/09/15 18:47, Rolston Jeremiah wrote:
> class Genus(models.Model):
> genus_id = models.AutoField(primary_key=True),
> scientific_genus = models.CharField(max_length=32),
> common_name = models.CharField(max_length=32),
> common_examples = models.TextField(),

It's probably because of the ',' at each line end.
I think genus_id became a tuple of fields, remove them and try again :)

--
Florian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/560ACDDF.7010201%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: How to serve any static directory?

2015-09-01 Thread Florian Schweikert
On 01/09/15 16:34, Yann Salaün wrote:
> In summary : is there a way to put something like `return
> serve_this_static_directory()` in the view? or is there any workaround
> there?

Not sure if I get you right, you want to serve static files with django?
Is there any reason why it's not possible to serve them with nginx/apache?

regards,
Florian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55E5B97B.3070607%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Using ModelForms

2015-08-31 Thread Florian Schweikert
On 25/08/15 01:25, Sait Maraşlıoğlu wrote:
> default = timezone.now()

Beware, timezone.now() will be evaluated once when the module is loaded,
not on save if you might think.
Use default = timezone.now without calling it to get the current value
on save.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55E4A768.5040606%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: I have error like Type Error save() takes at least 2 arguments (1 given) in Django project.

2015-08-31 Thread Florian Schweikert
On 31/08/15 12:10, Remaze Vs wrote:
> def save(self,request,*args,**kwargs):

You defined save to take a second positional argument, so it's no wonder
it crashes if you call .save()
If you need the request in the save method you have to pass it,
otherwise remove the request parameter.

See docs for .save() overwrite:
https://docs.djangoproject.com/en/1.8/ref/models/instances/#django.db.models.Model.save

regards,
Florian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55E435F1.4%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: ForeignKey Fields null=True does not imply blank=True

2015-08-26 Thread Florian Schweikert
On 26/08/15 11:59, khoobks wrote:
> I just discovered some interesting behaviour in Django 1.8.4 and was
> wondering if this was an unexpected side effect or specifically designed
> behaviour.

That behaviour is intended and documented[0].

blank and null working on completely different levels.
blank is only for validation in the django code.
null affects the database field.

It's useful if you like to force the user to input something in a field,
but at the same time you have to initialise a model with null at some
other place in your code.
e.g you are importing email addresses, but don't have names in your
current data. You can now easily force the user to set his/her name when
changing settings, without overwriting fields in a form.

regards,
Florian

[0] https://docs.djangoproject.com/en/1.8/ref/models/fields/#null

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55DDA5FB.3080600%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: 'self' is not define

2015-08-19 Thread Florian Schweikert
On 19/08/15 13:25, Remaze Vs wrote:
> username=self.request.user.username

What do you want to accomplish with this line?
This cannot work.
Where should self and self.request come from?

You probably want to us a ForeignKey to the User model.
(user = models.ForeignKey(User))
Afterwards you have to add request.user to the product in your view
where you save it.

Use something like
product = form.save(commit=False) # [0]
product.user = request.user
product.save()

And you should move your form to forms.py and add a view to views.py.

-- Florian

[0]
https://docs.djangoproject.com/en/1.8/topics/forms/modelforms/#the-save-method

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55D477E8.1010802%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Models and relationships

2015-07-06 Thread Florian Schweikert
On 06/07/15 14:04, Chris Strasser wrote:
> my problem is with reverse lookups (i think it is called) the docs say that i 
> can access entries through blog.entry,(by lowercaseing the class)
> it appears to me that i have the same setup with contact and location but i 
> am getting errors ??

I think you forgot about "_set".
Try something like:

Location.contact_set.all()

And please don't use AutoField, db_column and primary_key until you have
a good reason. Also ForeignKey fetches an object of the connected type,
not an id, so "contactid", ... is confusing ;)

--
Florian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/559AB201.40600%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


UnicodeError while searching in haystack/whoosh index

2015-04-28 Thread Florian Schweikert
Hi,

I'm working on an django-cms 3.0.13/py2.7 page atm and came across an
weird behaviour using haystack with whoosh.

When using rebuild_index everything works fine.
But using update_index afterwards leads to an UnicodeDecodeError when
searching for a page with umlauts.
Error thrown in "whoosh/reading.py | expand_prefix"

Assuming I interpret the rebuild and update command code correct,
rebuild just calls update after clean. So why does it work with rebuild
but not with update?

I'm using an adapted version of search_indexes.py example of the
django-cms project.[1]

Any ideas/solutions?

Many thanks,
Florian

[1] http://fpaste.org/216170/30221364/

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/553F738A.8080204%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: static files and DEBUG = False

2015-04-25 Thread Florian Schweikert
On 21/04/15 23:49, egon.frer...@gmx.de wrote:
> settings.py contains ALLOWED_HOSTS with the host in the form
> ".example.com". With DEBUG = True I get the complete page. But if I set
> DEBUG = False the static files are not found so I get only the content.

Django does not serve static files if DEBUG=False, and you really don't
want to do that.

> If DEBUG = True  the apache access log the static files are shown with
> HTTP-code 200. If DEBUG = False Apache is looking for the static files
> two times. The first try gives  status code 301, the second try gives 
> status code 500.
> 
> Any idea why this happens?

It's a bad idea to serve statics with Django.
It's ok for debugging, but not for production.
If you already use apache serve static files with Apache directly.

--
Florian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/553B3300.8040108%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: New data field in models.py "does not exist".

2015-01-12 Thread Florian Schweikert
On 12/01/15 19:16, dennis breland wrote:
> I ran these after making the changes:
> python manage.py sqlall recipe

manage.py sqlall just prints the sql statements for your models

> python manage.py syncdb

Do you use migrations?
If so did you run migrate?

What was the output of syncdb?

-- Florian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54B42099.4010308%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: what's different between {% static %} and {{ STATIC_URL}}

2015-01-08 Thread Florian Schweikert

On 2015-01-06 12:55, Andreas Kuhne wrote:

The difference is the age of the django project you are looking at. {%
load staticfiles %} the {% static %} is the current way to load and
use static files. It also has the option to do other things (like MD5
hashes for versions) automatically and should be used.


Also {% static %} works with your 500.html
As there is no context accessible if an 500 happen, {{ STATIC_URL }} is 
not available.


-- Florian

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b988a8e0735fca89751cd0f8d0ca45a3%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: Serving static files (admin panel and others)

2014-12-13 Thread Florian Schweikert
On 14/12/14 00:55, Muhammed Tüfekyapan wrote:
> I try many things to serve .css files but I can't do that. How can i
> serve .css and .js files in Django 1.7?
> 
> 
> I typed django manage.py collectstatic but still my admin panel don't
> load css.
> 
> What can i do?

did you follow the howto in the documentation?

https://docs.djangoproject.com/en/1.7/howto/static-files/

-- Florian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/548CF669.4050907%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Open a url with user and password

2014-12-09 Thread Florian Schweikert

On 2014-12-07 11:48, Hossein Rashnoo wrote:

Please help me.


this is quite unrelated to django, maybe it would be better asking this 
question on the python mailinglist[1]


-- Florian

[1] https://www.python.org/community/lists/

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/82d1df1fcd1f0e219d3be04dd04e5a0e%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: Redirect not working

2014-12-04 Thread Florian Schweikert
On 04/12/14 18:58, jogaserbia wrote:
> This is what I get from chrome when I click on the button in the
> index.html, but nothing else happens. I bolded what I believe should
> redirect to the testing UR with the lng and lat data.   

does it work with hardcoded url?
is the testing url in the rendered index.html?
if the javascript doesn't try to load the testing url there is something
wrong with your js.
Maybe $.get is supposed to get a success function as parameter? (wild
guessing, I'm not a js guy)

and why "redirect not working"? Can't see any redirects in your code.

-- Florian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5480A5BA.6070903%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Problem Making New Django project - please help

2014-12-04 Thread Florian Schweikert
On 03/12/14 16:36, Shashwat singh wrote:
> Django is properly installed but when i try to create a new project ---
> " django-admin.py startproject abc " it returns ^^ that error. 
> Any help will be highly appreciated.

starting new project with name abc throws the my_project.settings not
found? Then there is something wrong with the env_variables of your shell.

-- Florian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/548085D4.7000504%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Query set append

2014-12-02 Thread Florian Schweikert

On 2014-12-01 20:07, check.dja...@gmail.com wrote:

* I load the temple : template = loader.get_template(>.html>)
* i use context : context = RequestContext(request,{
'tableC_QuerySet': tableC_QuerySet,})
* return HttpResponse(template.render(context))


you may also have a look at the render shortcut:
https://docs.djangoproject.com/en/1.7/topics/http/shortcuts/#render

-- Florian

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cb1971d3ad75fb9e265532b1a72e4237%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: Problem Making New Django project - please help

2014-12-02 Thread Florian Schweikert

On 2014-12-02 10:59, Shashwat singh wrote:

ImportError: Could not import settings 'my_project.settings' (Is it on
sys.path? Is there an import error in the settings file?): No module
named my_project.settings

PLEASE HELP WITH THIS


there is not enough information to see the cause of the problem

what command did you run?
what was your cwd?
what does your project dir structure look like?

-- Florian

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8cf64f5650e73b5ac2184d62e41d1405%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: how to get back to a view requiring login

2009-10-11 Thread Florian Schweikert
2009/10/12 Sergio A. 

>
> I've three views each with different URL. They are visible to logged
> in users.
> If a non-logged user tries to access a URL requiring login, I'm able
> to redirect it to the login page.
>
> What I'm missing is how to go back to the initial page, once the user
> log in the system.
>
>
> Cheers, Sergio
> >
>
@login_required redirection using ?next=/path (I'm not 100% sure if this is
default)
your login have to look at this GET var

greets,
Florian

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



Authentication Backend: get access to request

2009-09-28 Thread Florian Schweikert
Hi,

I'm writing an own auth backend at the moment, but I need access to the
request object.
I found a possible solution with adding settings.request = request into a
middleware, but that's seems not beautilful to me.

My backend is something like this at the moment, to check the hash I need
the clientname (REMOTE_HOST doesn't work):

class MyRemoteUserBackend:

def authenticate(self, sKey, user):

username = user
user = None

if self.create_unknown_user and check_hash(username, sKey):
user, created = User.objects.get_or_create(username=username)
if created:
user = self.configure_user(user)

return user

def clean_username(self, username):
return username

def configure_user(self, user):
user.is_staff = False
# fetch userinfo from server ...
user.save()
return user

def check_hash(self, username, sKey):
from time import time
import socket

clientname = socket.gethostbyaddr( request.META['REMOTE_ADDR'] )[0]

if clientname == '':
clientname = 'nil'

# check hash and return boolean

Somebody has a nice solution for this?

thx,
Florian

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



Re: TemplateSyntaxError: VariableDoesNotExist

2009-09-25 Thread Florian Schweikert
2009/9/24 Brian McKeever <kee...@gmail.com>

>
> I would write a custom tag that wraps ugettext but checks for None.
>
> http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-filters
> http://docs.djangoproject.com/en/dev/topics/i18n/#standard-translation
>
> On Sep 24, 10:14 am, Florian Schweikert <kelvan.mailingl...@gmail.com>
> wrote:
> > Hello,
> >
> > {% trans Pagetitle %} produces TemplateSyntaxError when there is no
> > Pagetitle given, without translation django ignores it.
> > Why i18n can't translate/ignore NoneType? I don't want to use if around
> all
> > this varibles. Is there any more confortable way?
> >
> > greetings,
> > Florian
> >
> That's a good idea, thanks for the tip.

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



TemplateSyntaxError: VariableDoesNotExist

2009-09-24 Thread Florian Schweikert
Hello,

{% trans Pagetitle %} produces TemplateSyntaxError when there is no
Pagetitle given, without translation django ignores it.
Why i18n can't translate/ignore NoneType? I don't want to use if around all
this varibles. Is there any more confortable way?

greetings,
Florian

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



Re: verbose_name/i18n sometimes doesn't work in one app

2009-09-23 Thread Florian Schweikert
2009/9/23 

> Hi,
>
> I've a project with 2 apps, I'm using the meta class for defining
> verbose_name(_plural), register in admin.py.
> For The first app it works good, in the second django shows often the
> (buggy) generic name, for example:
>
> "Lv a_types"(the space is on the wrong place I think) and "possibilitys"
>
> it also forgot to translate it, after reloading the page it sometimes shows
> the right names.
>
> admin.py:
> from django.contrib import admin
> from webapps.ugm.models import *
>
> admin.site.register(FAQ, FAQAdmin)
> admin.site.register(Site, SiteAdmin)
> admin.site.register(QuickTip, QuickTipAdmin)
> [...]
>
> admin.py of working app:
> from django.contrib import admin
> from webapps.books.models import *
>
> admin.site.register( Book, BookAdmin )
> admin.site.register( Publisher, PublisherAdmin )
> admin.site.register( Author, AuthorAdmin )
> [...]
>
> anybody knows this problem (using 1.0 on lenny)?
> is there a django-logfile anywhere?
>
> greetings,
> Florian
>

Seems to work now, don't know why but it works.

greets,
Florian

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



Re: Django1.1 logs me out after few seconds inactivity

2009-09-13 Thread Florian Schweikert
Maybe it's that old bug:
http://blog.umlungu.co.uk/blog/2007/may/20/cookie-problem-django-admin/
Server Upgrade to Lenny is planned in the near future, I hope the problem
solves itself with the dist-upgrade.

greetz,
Florian

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



Re: Django1.1 logs me out after few seconds inactivity

2009-08-25 Thread Florian Schweikert
Now I'm able to login etc, but only with django-server, with apache also the
admin interface informs me that my browser doesn't allow cookies. So there's
a problem with apache and/or mod_python. :-/
I'll test this after the planned upgrade to lenny 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
-~--~~~~--~~--~--~---



Re: Django1.1 logs me out after few seconds inactivity

2009-08-24 Thread Florian Schweikert
Thanks for your patience, I created a new project with only a login-page and
a small 'debug' page, seems to work at this stage. Next I will test my own
auth_backend, if this problem appears again (I hope not), I'll be able to
localise it a bit better.

greetings,
florian


2009/8/21 Russell Keith-Magee <freakboy3...@gmail.com>

>
> On Fri, Aug 21, 2009 at 9:10 PM, Florian
> Schweikert<kelvan.mailingl...@gmail.com> wrote:
>
> > In summary:
> > * On the server (etch) session flushes by request.user.is_authenticated()
> > (e.g session.user switched to anonymous without any findable reason)
> after a
> > while equal if session still marked active in database and cookie.
> > * On Ubuntu exactly the same application changing the key every request
> but
> > session in cookie is still the first key.
> > * There is no difference if I use Django-server instead of Apache.
>
> The good news is that this is Python and it is open source, so you
> have all the tools you need to diagnose the problem. The great news is
> that you can reproduce the problem with the development server, so you
> won't have to jump through hoops to debug the problem.
>
> Some pointers into the source code:
> django/contrib/auth/__init__.py: login() - this is the method that
> logs you in, and sets the cookie that acts as the session key. It's
> also responsible for flushing the session if a non-matching user-id is
> found.
>
> django/contrib/sessions/middleware.py - this is the module that
> defines the session middleware. This is the code that looks for the
> session cookie, and constructs the Session object based on the data
> retrieved from the database for that session. It also ensures that the
> Session data is written back when the response is handed back.
>
> django/contrib/sessions/backends/base.py - this is the core
> implementation of session itself if you need to dig into how and when
> session data is saved.
>
> I'd love to offer more help, but in this case, there is _literally_
> nothing else I can do. The only person who is having this problem is
> you. Outside of the conditions I explained earlier, plus the
> pathological case where you have cookies turned off or something is
> eating your cookie jar, I haven't ever seen this behaviour in Django.
>
> I can appreciate that this is frustrating, but if you want to solve
> this, you're going to need to crack open PDB - or even just put lots
> of print statements in the code - until you can establish when the
> cookie is changing. Hopefully we can both learn something from the
> experience - if you have found a genuine bug in Django, we're
> certainly keen to fix it. However, in order to fix it, we have to know
> what it broken.
>
> 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
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django1.1 logs me out after few seconds inactivity

2009-08-21 Thread Florian Schweikert
Tried to use sqlite, to test if it's a db problem, but django aren't able to
open a sqlite databasefile which has the right permissions. Trying postgres
next.

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



Re: Django1.1 logs me out after few seconds inactivity

2009-08-21 Thread Florian Schweikert
I tried it on my notebook with the django server, the cookie wasn't touched,
but request.session.session_key changes every request.

Using the db session backend avoid login, cached_db and cache works
temporally.

In summary:
* On the server (etch) session flushes by request.user.is_authenticated()
(e.g session.user switched to anonymous without any findable reason) after a
while equal if session still marked active in database and cookie.
* On Ubuntu exactly the same application changing the key every request but
session in cookie is still the first key.
* There is no difference if I use Django-server instead of Apache.
* I have no idea how I can test such things in python-shell, because I found
no way to create a working request object or save one to a file. The Django
modules feeling like a Blackbox, docs only shows a minimum overview how it
should work.
* Django is even more frustrating for me than the PHP-crap, and that is
extreme frustrating (I love Python and it never frustrates me like this).

grrreets,
florian

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



Re: Django1.1 logs me out after few seconds inactivity

2009-08-21 Thread Florian Schweikert
I wrote a tiny page which just shows the session_key.
I can refresh this site and the key is the same, but if I open one of the
other pages the request.user.is_authenticated() method opens a new session.
:(

Nevertheless thanks for your ideas.

greets,
florian

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



Re: Django1.1 logs me out after few seconds inactivity

2009-08-21 Thread Florian Schweikert
2009/8/21 Russell Keith-Magee 

>
> On Fri, Aug 21, 2009 at 12:17 AM, Kelvan
> wrote:
> >
> > I've a big problem with user authentification, my application get an
> > username and a hashkey to verify if the user is logged in. I wrote a
> > function that check this, it worked fine to log in the user with:
> >
> > user.backend = 'django.contrib.auth.backends.ModelBackend'
> > login( request, user )
> >
> > Login works, clicking around works, but doing nothing a few seconds
> > and than click on a menu entry logs me out and redirects to the login
> > screen.
> >
> > debug_toolbar shows me this sql queries (all made by
> > request.user.is_authenticated):
> >
> >SELECT `django_session`.`session_key`,
> > `django_session`.`session_data`, `django_session`.`expire_date` FROM
> > `django_session` WHERE (`django_session`.`session_key` =
> > 8373a54580503b02238a3f45 AND `django_session`.`expire_date` >
> > 2009-08-20 17:59:44 )
> >
> >SELECT `django_session`.`session_key`,
> > `django_session`.`session_data`, `django_session`.`expire_date` FROM
> > `django_session` WHERE `django_session`.`session_key` =
> > a2aabd791f8e593d9dbf7e21
> >
> >
> >INSERT INTO `django_session` (`session_key`, `session_data`,
> > `expire_date`) VALUES (a2aabd791f8e593d9dbf7e21,
> > gAJ9cQEuMDAwMDAwMDA0OGU1MTExNWYxNzY3YjcyZjc2MmFkZGI= , 2009-08-20
> > 18:59:45)
> >
> > I check the database and the first session expire_date is in the
> > future, so the session is active, but why did Django flushes the old
> > session and creating a new one?
>
> I've seen this in the past, with a couple of different causes:
>
>  - Safari and Firefox both have a "private browsing" setting that can
> cause this behavior.
>
>  - You can also have this problem if you are having DNS or other
> related name resolution errors (for example if your DNS entry is
> propagating, or you're on dynamic DNS, or you're playing reverse DNS
> tricks behind a proxy).
>
>  - If you are running two sites with the same site secret, the two
> sites can tread on each other.
>
> I don't know if these are causing your problems in particular, but
> hopefully it gives you some ideas. Worst case, crack open the debugger
> and look at the sessions backend to see what code branch is causing
> the session to expire.
>
> Yours,
> Russ Magee %-)
>
> >
>
private browsing is deactivated, there isn't a second page with same secret.

But I have reverse DNS problems, REMOTE_HOST is always None (there is no
lookup, apache reverse lookup is on and working).

I tested this with Opera and I'm even not able to login. With FF this works
most of the time.
Also if I login with normal auth and login it kicks me out.
With Opera it's extrem freaky, when I click on my home menu entry session
doesn't changed. with a click on another menu it changes every click.

I planned to replace a old PHP app with a modern django app, but if I
already have problems with login I doubt this plan. :(

I'm going to test this without apache now.

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