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.


database names in queries on multiple databases

2017-07-10 Thread Florian Wegscheider
TLTR: Django does not include database names in SQL queries, can I somehow 
force it to do this, or is there a workaround?

The long version:

I have two unmanaged legacy MySQL databases (Note: I have no influence on 
the DB layout) for which I'm creating a readonly API using DRF on Django 
1.11 and python 3.6 

I'm working around the referential integrity limitation of MyISAM DBs by 
using the SpanningForeignKey field suggested here: 
https://stackoverflow.com/a/32078727/7933618

I'm trying to connect a table from DB1 to a table from DB2 via a ManyToMany 
through table on DB1. That's the query Django is creating:
  
SELECT "table_b"."id" FROM "table_b" INNER JOIN "throughtable" ON ("table_b"
."id" = "throughtable"."b_id") WHERE "throughtable"."b_id" = 12345

Which of course gives me an Error "Table 'DB2.throughtable' doesn't exist" 
because throughtable is on DB1 and I have no idea how to force Django to 
prefix the tables with the DB name. The query should be:
   
SELECT table_b.id FROM DB2.table_b INNER JOIN DB1.throughtable ON (table_b.id 
= throughtable.b_id) WHERE throughtable.b_id = 12345

Models for app1 `db1_app/models.py`:

class TableA(models.Model):
id = models.AutoField(primary_key=True)
# some other fields
relations = models.ManyToManyField(TableB, through='Throughtable')


class Throughtable(models.Model):
id = models.AutoField(primary_key=True)
a_id = models.ForeignKey(TableA, to_field='id')
b_id = SpanningForeignKey(TableB, db_constraint=False, to_field='id'
)

Models for app2 `db2_app/models.py`:

class TableB(models.Model):
id = models.AutoField(primary_key=True)
# some other fields

Database router:

def db_for_read(self, model, **hints):
if model._meta.app_label == 'db1_app':
return 'DB1'

if model._meta.app_label == 'db2_app':
return 'DB2'

return None

Can I force Django to include the database name in the query? Or is there 
any workaround for this?

I also posted this question on StackOverflow - to no avail, so I'll try 
here.
https://stackoverflow.com/questions/45018277/django-manytomany-through-with-multiple-databases

-- 
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/0f4e3da3-7fbe-4abf-a3a4-77bb0415e6a0%40googlegroups.com.
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: Django 1.11 released

2017-04-05 Thread Florian Apolloner
Not on purpose no -- if it doesn't work with 4.1 that is a bug

On Wednesday, April 5, 2017 at 11:07:13 AM UTC+2, jorr...@gmail.com wrote:
>
> Is the required version of Pillow pinned at 4.0.0? I upgraded to Django 
> 1.11 and from Pillow 4.0.0 to 4.1.0 but now Django doesn't start because it 
> says I can't use ImageField without installing Pillow. Downgrading to 
> Pillow 4.0.0 fixes this.
>
>
> On Tuesday, April 4, 2017 at 6:09:40 PM UTC+2, Tim Graham wrote:
>>
>> Django 1.11, the next long-term support release, is now available:
>>
>> https://www.djangoproject.com/weblog/2017/apr/04/django-111-released/
>>
>> With the release of Django 1.11, Django 1.10 has reached the end of 
>> mainstream support. The final minor bugfix release (1.10.7) was issued 
>> today. Django 1.10 will receive security and data loss fixes for another 
>> eight months until December 2017.
>>
>> Django 1.9 has reached the end of extended support. The final security 
>> release (1.9.13) was issued today. All Django 1.9 users are encouraged to 
>> upgrade to Django 1.10 or later.
>>
>> See the downloads page [1] for a table of supported versions and the 
>> future release schedule.
>>
>> [1] https://www.djangoproject.com/download/#supported-versions
>>
>

-- 
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/5ebf0769-452d-44b1-9241-acb3da2f31db%40googlegroups.com.
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


Logs bloated by template variable not found in DEBUG level

2017-02-08 Thread Florian Perrodin
Dear all,

What is the proper way of checking if a variable exists in django?
To my knowledge, the proper way is to use the {% if var %} tag. If this is 
the case, it should not trigger a print in the output (even in the debug 
log level). Hereafter is an example:

# Note: django 1.10.2
from django.template import Context, Template

context = Context({})
template = Template("{% if avar %}bla{% endif %}")

# output
##
DEBUG 2017-02-08 10:19:14,844 base 3090 139658596226880 Exception while 
resolving variable 'avar' in template 'unknown'.
Traceback (most recent call last):
  File "***/python3.4/site-packages/django/template/base.py", line 885, in 
_resolve_lookup
current = current[bit]
  File "***site-packages/django/template/context.py", line 75, in 
__getitem__
raise KeyError(key)
KeyError: 'avar'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "***site-packages/django/template/base.py", line 891, in 
_resolve_lookup
if isinstance(current, BaseContext) and getattr(type(current), bit):
AttributeError: type object 'Context' has no attribute 'avar'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "***site-packages/django/template/base.py", line 900, in 
_resolve_lookup
current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'avar'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "***site-packages/django/template/base.py", line 907, in 
_resolve_lookup
(bit, current))  # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [avar] in 
"[{'True': True, 'False': False, 'None': None}, {}]"
##

I however agree that the following code should generate an debug trace

from django.template import Context, Template

context = Context({})
template = Template("{{ avar }}")


Is there a workaround? Another way to check properly if a variable exists? 
- Note that I want to see other DEBUG messages, so I don't want to change 
the log level

Best 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/c8cfc93e-3426-48a9-ab77-5154f496f9a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: cache.get_or_set : function name is misleading

2016-08-31 Thread florian


Le mercredi 31 août 2016 14:19:39 UTC+2, daniel.franca a écrit :
>
> But it's okay, isn't it?
> I mean, *add* is used to add the key if the key doesn't exist.
> *set* on the other hand, will set the value anyway.
>
> In the case of *get_or_set *the set should work like an *add *because 
> it'll be called only in case the key doesn't exist.
>
> Or am I missing something?
>

You're right on the expected behaviour. My point is that the function 
should have been named get_or_add since it is self explanatory. Reading the 
name get_or_set, i expect the function to first perform a get and then a 
set if the key is not there.

I'll try to see if i can submit something interesting for the doc.

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/529136a5-f5c7-48db-b002-3eb678d0857e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


cache.get_or_set : function name is misleading

2016-08-31 Thread Florian Iragne

Hi,

I wanted to refactor my code using cache.get_or_set instead of using 
cache.get and then check for None and so on


However, after a few tests, it seems that get_or_set does not work as 
its name suggests: it is more get_or_add than get_or_set


Looking at the source code, it indeed does a get, then a add, not a set.

To my mind, the function name is misleading, even if after a careful 
reading of the doc, it explains that the value is added (not set) if not 
in the cache.


I haven't found anything about this, so i may be the only one astonished 
by the difference between function name and function main behaviour. 
However, i think it's useful to live a comment about this for other devs.


Cheers

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/46cbd955-705d-2d52-e1db-a88a40b7c635%40iragne.fr.
For more options, visit https://groups.google.com/d/optout.


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: selecting an item whose relations are all in some desired set

2016-05-17 Thread Florian Iragne

Le 17/05/2016 16:18, David Xiao a écrit :

Hi Florian,
That's technically correct, but the universe of all possible items 
might be very large or even infinite so it's not really practical to 
do it that way.




I understand, but i don't now your case precisely. In my case, i do this 
for a few thousands of "items" and it works like i want. However, it's 
clearly not optimal.


You can use raw sql if you want/can

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/573B2925.9050203%40iragne.fr.
For more options, visit https://groups.google.com/d/optout.


Re: selecting an item whose relations are all in some desired set

2016-05-17 Thread florian


Le mardi 17 mai 2016 14:04:28 UTC+2, David Xiao a écrit :
>
> Hi Vitor,
>
> Sorry I realized that my example should have used a ManyToManyField 
> instead of a 1-to-many.  Let me try again:
>
> class Bundle(Model)
>   items = ManyToManyField("Item")
>
> class Item(Model)
>   pass
>
> (So one item can belong many Bundles and one Bundle can have many Items.)
>
> Suppose I've created items item1, item2, item3 and I have special_items = 
> [item1, item2].  Suppose also the following Bundles exist in the database:
> 1. Bundle containing item1
> 2. Bundle containing item2
> 3. Bundle containing item1, item2
> 4. Bundle containing item2, item3
> 5. Bundle containing item1, item2, item3
>
> I want to select all bundles where *every item in the bundle* is in 
> special_items.  This means selecting bundles 1, 2, 3 but not bundles 4, 5 
> (because item3 is not in special_items).
>
> The query you gave would select no bundles, and the query 
> Bundle.objects.filter(items__in=[special_items]) would select all the 
> bundles.
>
> Dave
>


an exclude on all items that are not in special_items?

exclude(items__in=[not_special_items])

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/5ecb6508-5a62-4cb3-a5bc-204ec0162483%40googlegroups.com.
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.


How to use django's admin "filter_horizontal" in my app ?

2016-05-09 Thread Florian Supper
Hi @ all,

I'm looking for a way how to get the amazing function *"filter_horizontal"* 
which i use in django's admin site available in my bootstrap3 form.

I've searched some days, but i cant find no way to get it working..

So please could one of you help me!

#models.py
Class TestModel(models.Model):
field1 = models.ManyToManyField('Contacts')
field2 = models.ForeignKey('Testuser')

#forms.py
class TestForm(ModelForm):
class Meta:
model = TestModel
fields = ['fiedl1','field2',]

#views.py
class CreateTestView(CreateView):
form_class = TestForm
template_name = 'myapp/test.html'

#test.html
{% block content %}


{% load bootstrap3 %}

 Add a new entry 

{% bootstrap_messages %}


  {% csrf_token %}
  {% bootstrap_form form %}
  {% buttons %}

  {% bootstrap_icon "star" %} Create

  {% endbuttons %}



{% endblock %}

#urls.py
urlpatterns = [
 url(r'^test/add/$',  views..CreateTestView.as_view(), 
 name='create_test'),
]

Thanks for your help!

BR
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/32588818-d1ae-4212-9c6a-9eaf687bb495%40googlegroups.com.
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


execute python through ajax

2016-03-09 Thread Florian Hoedt
Hello Django users,
I would like to execute some python code by JS. For example if somebody 
clicks on a openlayers map it should execute a python based query and get 
the result as JSON to render it on the map.
How would I achieve something like this?

I am trying to understand the forms section of the official django tutorial 
without success.

-- 
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/a293a0a0-32a0-4333-aefd-d5c15e810a60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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.


Re: Is it possible to connect django to apache derby as a database?

2015-06-05 Thread Florian Apolloner
If it speaks SQL you can just write your own backend for it, but that is 
probably a bit of work.

On Friday, June 5, 2015 at 2:05:40 PM UTC+1, Uk Jo wrote:
>
> I am a newbie about Django and Python. But I attended the basic lecture of 
> python. So I will implement my web application.
> I want to use apache derby. Is is possible? I am proud of being one of 
> member in this group. 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/03f927c2-fada-409a-8b31-5eaff4ce8079%40googlegroups.com.
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: Django phonegap CORS

2015-03-18 Thread Florian Auer
Hello Filipe

The idea with the inAppBrowser was great.
I allready was using this plugin but not that way

Solution for me looks like the following:
1. I'm still using djangorestframework-jwt in the first to check the user 
credentials
   - token given from server = credentials OK
   - no token in response = wrong credentials
2. launch the inApp browser in "hidden mode" for the login screen and 
inject the credentials by script
3. use callbacvk from injection to turn inApp browser in "visible mode"

Many Thanx for our help

Am Freitag, 13. März 2015 21:33:36 UTC+1 schrieb Filipe Ximenes:
>
> Alright, I think I got what you want now.
>
> The first solution that comes to mind is to perform everything in the 
> browser. That way, you will first perform "window.open()" and then show a 
> "login view" from django server.
>
> I don't have any experience with Phonegap, but it seems that this can also 
> help you:
>
> http://docs.phonegap.com/en/edge/cordova_inappbrowser_inappbrowser.md.html#addEventListener
>
> Maybe if you attach a "loadstart" event to the browser and save user 
> credentials to "localStorage" or a cookie, using the method described here:
>
> http://blogs.telerik.com/appbuilder/posts/13-12-23/cross-window-communication-with-cordova's-inappbrowser
>
> Since everything will be working in a common browser application (not a 
> single page application, or phonegap app), I'd suggest you to work with 
> default Django cookie session and not with a token based authentication. 
> This will be simpler since once you set the cookie, the browser will take 
> care off passing it over page requests and you will not need to make 
> customisations to your Django views regarding authentication.
>
> On Fri, Mar 13, 2015 at 4:53 PM, Florian Auer <f.c@gmail.com 
> > wrote:
>
>> Hello Filipe
>>
>> Thank you for the reply. 
>> Well the $http object was till now unknown for me.. there we can see how 
>> poor my AngularJS knowledge is till now.
>>
>> But as far as i understood the documentation i am not able to bring up a 
>> browser window by this that takes over the control of the app.
>>
>>
>> The idea behind all is the following, maybe i did not describe it well.
>>
>> The App is only thought a a "startUp wrapper" with stored credentials in 
>> form of a login token.
>> That token is claimed in a first asynchronous request with user 
>> credentials asked for interactively.
>> Later on when the token is known, the app only sets the headers an calls 
>> the django web page where the user gets logged in due the header 
>> automatically.
>>
>> At the moment I was using the JWT (
>> http://getblimp.github.io/django-rest-framework-jwt/) to claim a token. 
>> But i do not know how to use this to let the user been logged in with the 
>> call of a browser window.
>> Maybe I need tho turn over to TokenBasedAuthentification like described 
>> in (
>> http://www.django-rest-framework.org/api-guide/authentication/#tokenauthentication
>> )?
>> But then I will still have the same problem... How to bring the token 
>> into the headers and thenn call a page from the server rendered inside the 
>> browser in UI mode (not in the app as sub page)
>>
>> My idea was, that an phonegap app is nothing more than a browser rendered 
>> app.
>> When I can create a request to a server to claim an Auth Token and be 
>> able to set this into the headers, the next Ui request to the server 
>> (launching another browser window by window.open()) will let me call 
>> directly to a restricted view.
>>
>>
>>  -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/db6f6050-b1b9-4ea4-9729-94a3184c5e82%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/db6f6050-b1b9-4ea4-9729-94a3184c5e82%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>   
>
> *Filipe Ximenes*+55 (81) 8245-9204
>
> *Vinta Software Studio*http://www.vinta.com.br
>  

-- 
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/164005fc-c287-4e8e-bff1-563be5fe0492%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django phonegap CORS

2015-03-13 Thread Florian Auer
Hello Filipe

Thank you for the reply. 
Well the $http object was till now unknown for me.. there we can see how 
poor my AngularJS knowledge is till now.

But as far as i understood the documentation i am not able to bring up a 
browser window by this that takes over the control of the app.


The idea behind all is the following, maybe i did not describe it well.

The App is only thought a a "startUp wrapper" with stored credentials in 
form of a login token.
That token is claimed in a first asynchronous request with user credentials 
asked for interactively.
Later on when the token is known, the app only sets the headers an calls 
the django web page where the user gets logged in due the header 
automatically.

At the moment I was using the JWT 
(http://getblimp.github.io/django-rest-framework-jwt/) to claim a token. 
But i do not know how to use this to let the user been logged in with the 
call of a browser window.
Maybe I need tho turn over to TokenBasedAuthentification like described in 
(http://www.django-rest-framework.org/api-guide/authentication/#tokenauthentication)?
But then I will still have the same problem... How to bring the token into 
the headers and thenn call a page from the server rendered inside the 
browser in UI mode (not in the app as sub page)

My idea was, that an phonegap app is nothing more than a browser rendered 
app.
When I can create a request to a server to claim an Auth Token and be able 
to set this into the headers, the next Ui request to the server (launching 
another browser window by window.open()) will let me call directly to a 
restricted view.


-- 
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/db6f6050-b1b9-4ea4-9729-94a3184c5e82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django phonegap CORS

2015-03-13 Thread Florian Auer
Thanks to Filipe, the asynchronous request to django is working correctly.
A request to the endpoint url results in a JSON response with the token in 
it.

But now I have another gap in my "logic".

Inside this angular app the django site is requested via a call like this, 
to takeover control from the app.
var ref = window.open(url, '_self', 'location=yes');
ref.addEventListener('exit', function(event) {
alert(event.type);
});

The question is, how can I make a call the restricted view on the django 
site with the token included, to log in the user.
Would it be a possibility to add the token as GET argument to the url?

too many trees in this forest :)


-- 
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/00ca9fea-316e-405b-95ba-3bc554a0274d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.8b2: m2m signal raising ProtectedError now affects unrelated queries inside tests

2015-03-12 Thread Florian Apolloner
Hi Peter,

On Thursday, March 12, 2015 at 11:26:21 AM UTC+1, Peter Schmidt wrote:
>
> I think it's related to this documented change:
>
> https://docs.djangoproject.com/en/dev/releases/1.8/#related-object-operations-are-run-in-a-transaction
>

Exactly
 

> We can fix it by catching the known instance of ProtectedError explicitly 
> which we probably should be doing in our signal anyway.
>

Yes, you should
 

> But it's not clear if we can always catch ProtectedError for all possible 
> protected relationships, and whether that could be a symptom of something 
> that might affect more downstream code (like possibly different future 
> requests to a Django app server with persistent DB connections... just a 
> hypothesis?). Django's deep ORM internals are well out of my depth so if 
> anyone can shed light on this (e.g. hopefully I'm completely wrong with my 
> hypothesis), that would be appreciated.
>

At the end of requests, the transactions are reset anyways, leakage into 
other requests (persistent connection or not) cannot happen.
 
Cheers,
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/ffcc5e68-226f-4abd-b047-b5067dc65442%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django phonegap CORS

2015-03-12 Thread Florian Auer
Thank you for your reply Filipe 

The question behind was: 
How to implement a cross domain communication between a phonegap App and a 
django web project

You're right I forgot the django site for the server-side headers in my 
mind.
I'll give it a try with the plugin and test how far i come with it.

Thanx again.

Am Donnerstag, 12. März 2015 00:29:56 UTC+1 schrieb Filipe Ximenes:
>
> Not 100% sure I understood your question, but it seems that you are trying 
> to overcome the CORS only from the frontend side when you should be 
> treating it from the Django side. 
> Could you take a look on this package:
> https://github.com/ottoyiu/django-cors-headers
>
> If it suits your needs, a good idea is to have your API endpoints 
> beginning with something like "/api/{whatever you want}" and set:
>
> CORS_ORIGIN_ALLOW_ALL = True
>
> CORS_URLS_REGEX = r'^/api/.*$' 
> -- 
>   
>
> *Filipe Ximenes*+55 (81) 8245-9204
>
> *Vinta Software Studio*http://www.vinta.com.br
>  

-- 
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/3316570b-4461-4bf1-968b-3f1ec9ebdee8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django phonegap CORS

2015-03-11 Thread Florian Auer
Hello

I'm am stuck in a problem dealing with an CORS request from a phonegap app 
to an django application.

What I have so far is the following:
- a regular django web project
- a phonegap app build on angularJS for some settings.


   - The idea is, that users can use the app to store relevant server 
   informations like host, port, etc.
   - The app requests a token from the django project that identifies the 
   user and uses it for further page loads.
   - Via a link or other redirect the app calls the django site and log in 
   the user 

At the moment i can call the django site by using the app but the user has 
to log in manally.
This has to be automated.

Therefore i added the "REST Framework" and "JWT auth" to the django project.

a curl call to the project results in a correct JWT token.
curl -X POST -d "username=djangoadmin=secret" http:
//192.168.1.183:8080/api-token-auth/

Well the question is now how to implement this call in the app due the CORS 
situation.

I tried some examples like

   - http://www.html5rocks.com/en/tutorials/cors/
   - 
   http://jamesbrewer.io/2014/10/31/json-web-token-authentication-part-two/

but all failed :)

another try was:

var params = "username=" + user + "=" + passwd;

var xhr = Utils.createCORSRequest('GET', 
'192.168.1.183:8080/api-token-auth/');
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.setRequestHeader("Content-length", params.length);
xhr.onload = function () {
   console.log(this.responseText);
};
xhr.send(params);

So far i would say my knowledge for the CORS situation via JQuery is a bit 
too low.

Maybe someone has an idea how to request the token inside the app and later 
on use it to call the django site and make an auto login.

Any help welcome :)

-- 
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/34f27d1f-a282-477e-87d8-dffbfa62de2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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.


nested inclusion tag that takes context

2014-11-28 Thread Florian Auer
Hi folks

I have written 2 simple inclusion tags where one is nested inside the other.
(settings.html uses the {% version %} tag)

Both ones refer to the request object inside the context.
The reason for this is, that I have a middleware that sets some flag 
variables to determine what type of client i'm serving.

code example:
@register.inclusion_tag('inclusion/settings.html', takes_context=True)
def settings(context):
request = context['request']

#needed for the template
return {'is_mobile:': request.is_mobile,
'is_tablet': request.is_tablet,
'is_phone': request.is_phone,
'user': request.user
}
@register.inclusion_tag('inclusion/version.html', takes_context=True)
def version(context):
request = context['request']

version_nr = '0.0.0'
version_date = '01.01.1970'
f = open(os.path.join(BASE_DIR, 'version.txt'), 'r')
for line in f:
token = line.split(':')
if token[0] == 'version':
version_nr = token[1]
elif token[0] == 'datum':
version_date = token[1]
f.close()

return {'is_mobile:': request.is_mobile,
'is_tablet': request.is_tablet,
'is_phone': request.is_phone,
'version_nr': version_nr,
'version_date': version_date
}

If i now user the {% version %} tag inside the settings.html th system 
complains that context['request'] is not defined for the version() function.
It seems I can fix this by putting the request object into the return 
object of the settings funktion like:
@register.inclusion_tag('inclusion/settings.html', takes_context=True)
def settings(context):
request = context['request']

return {'request': request,
'is_mobile:': request.is_mobile,
'is_tablet': request.is_tablet,
'is_phone': request.is_phone,
'user': request.user
}
But is this the correct way?


Also interesting is:
If I leave out the addiotion sending the request insite the result of 
settings back, the context object inside the version function seems to have 
an unnamed property at the second index that may to be some kind of request 
object.

[{'None': None, 'True': True, 'False': False}, 
 {'is_mobile:': True, 'user': >, 'is_phone': 
False, 'csrf_token': , 'is_tablet': True}
]





-- 
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/54e95b28-adb2-46af-8e5d-d55b0d60780c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django & gunicorn: KeyError with active log-config setting

2014-11-13 Thread Florian Auer
Hi

I wanted to let my gunicorn server to log its config into a dedicated file.
Therefore I added an extra line:
exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--log-level=debug \
--bind=unix:$SOCKFILE \
--log-file=$ERRLOG \
--access-logfile=$LOGFILE \
--log-config=$CONFLOG # added this line with the \ before

But when i start the server with supervisorctl i receive a "KeyError" for 
the formatters.
Traceback (most recent call last):
  File "/webapps/sonar3/tekkoSONAR/../bin/gunicorn", line 11, in 
sys.exit(run())
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/app/wsgiapp.py"
, line 74, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/app/base.py", 
line 185, in run
super(Application, self).run()
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/app/base.py", 
line 71, in run
Arbiter(self).run()
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/arbiter.py", 
line 57, in __init__
self.setup(app)
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/arbiter.py", 
line 88, in setup
self.log = self.cfg.logger_class(app.cfg)
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/glogging.py", 
line 175, in __init__
self.setup(cfg)
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/glogging.py", 
line 203, in setup
disable_existing_loggers=False)
  File "/usr/local/lib/python3.3/logging/config.py", line 70, in fileConfig
formatters = _create_formatters(cp)
  File "/usr/local/lib/python3.3/logging/config.py", line 103, in 
_create_formatters
flist = cp["formatters"]["keys"]
  File "/usr/local/lib/python3.3/configparser.py", line 937, in __getitem__
raise KeyError(key)
KeyError: 'formatters'
- log file exists
- permissions math
Keeping the --log-config out of the command, everything start correctly.

Any help / idea welcome

-- 
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/f186205f-8feb-4d32-8d41-7f41a9b9bfdb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: transpose values_list result from ORM

2014-10-05 Thread Florian Auer
Ha, I think i got it

the result from my databes is a values_list with tupels that cannot be 
acced via name.
I have to use the indizes:
for kz in kzlist:
data.setdefault(kz[1], {})[kz[0]] = kz[2]


Am Sonntag, 5. Oktober 2014 16:07:02 UTC+2 schrieb Florian Auer:
>
> Hi
>
> the original variant was claiming a type mismatch:
> Traceback (most recent call last):
>   File "", line 2, in 
> TypeError: tuple indices must be integers, not str
>
> The same with your code example.
> Maybe the reason is that date is not an integer as it looks like, but a 
> string representation of it?
>
> Am Donnerstag, 2. Oktober 2014 20:03:39 UTC+2 schrieb Collin Anderson:
>>
>> Assuming "klist" is a typo, your setdefault code _should_ give you 
>> something close to what you want, though not exactly in a table. What 
>> happens when you try? 
>>
>> I simplified your code slightly:
>> data = {}
>> for kz in kzlist:  # assuming klist was a typo
>> data.setdefault(kz['date'], {})[kz['key']] = kz['value']  # slightly 
>> simpler 
>>
>> How are you displaying the information?
>>
>

-- 
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/e4eda96c-435e-43c9-8a08-d9ebc35a15fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: transpose values_list result from ORM

2014-10-05 Thread Florian Auer
Hi

the original variant was claiming a type mismatch:
Traceback (most recent call last):
  File "", line 2, in 
TypeError: tuple indices must be integers, not str

The same with your code example.
Maybe the reason is that date is not an integer as it looks like, but a 
string representation of it?

Am Donnerstag, 2. Oktober 2014 20:03:39 UTC+2 schrieb Collin Anderson:
>
> Assuming "klist" is a typo, your setdefault code _should_ give you 
> something close to what you want, though not exactly in a table. What 
> happens when you try? 
>
> I simplified your code slightly:
> data = {}
> for kz in kzlist:  # assuming klist was a typo
> data.setdefault(kz['date'], {})[kz['key']] = kz['value']  # slightly 
> simpler 
>
> How are you displaying the information?
>

-- 
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/8bfcb92e-1957-4333-8b45-59c906b84112%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


transpose values_list result from ORM

2014-10-02 Thread Florian Auer
Hi

I have a ORM query that results something like this:
+-+-+---+
|  date   | key | value |
+-+-+---+
| 201312  |  A  | 123   |
| 201312  |  B  | 223   |
| 201312  |  C  | 133   |
| 201311  |  A  | 173   |
| 201311  |  B  | 463   |
| 201311  |  C  | 463   |
+-+-+---+

As far as i know, django cannot transpose a query so i need do get this 
into the following format in another way:
+-+-+-+-+
|  date   |  A  |  B  |  C  |
+-+-+-+-+
| 201312  | 123 | 223 | 133 |
| 201311  | 173 | 463 | 463 |
+-+-+-+-+

I tried something like a loop and the setdefault(), but my knowledge in 
python seems to be too poor.
kzlist = XYZ.objects.filter(...).values_list('date', 'key', 'value')
data = {}
for kz in klist:
data.setdefault(kz['date'], {}).update({'%s' % kz['key'] : kz['value']})

Has anyone an advice to solve this little problem?

-- 
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/d3d3247f-57f6-49fa-9ec0-df25a6690e71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.6 Nginx with static files outside project folder

2014-09-22 Thread Florian Auer
Hi
Yes thats correct, but i checked the static directory in 
/webapps/sonar3/static and the files for the admin page and the plugin 
specific files also are present here.
But the system tries to load them from /webapps/sonar3/myproject/static.

Am Samstag, 20. September 2014 00:55:40 UTC+2 schrieb Collin Anderson:
>
> so if you go to http://myproject.de:8001/static/some-file-in-myproject.css 
> it works fine, but if you go to 
> http://myproject.de:8001/static/admin/js/jquery.js you get a 404 Not 
> Found?
>
> Are the files you're looking for actually in webapps/sonar3/static?
>
>

-- 
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/e21d689c-ccec-4882-9418-0cd4ecb5037b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.6 Nginx with static files outside project folder

2014-09-18 Thread Florian Auer
Hello.

It seems im stuck in the try to deploy my django project, consisting of 
multiple apps, to the production server at the point of serving the static 
files from the preferred directory.

system details:
- CentOS 6.5
- Django 1.6.4
- green Unicorn python server
- Nginx webserver
- python 3.3.5

pyvenv layout:
|-webapps
| |-sonar
| | |-bin
| | |-include
| | |-lib   #site-packages folder insite
| | |-logs  #server logfiles 
| | |-run   #sock files
| | |-static#collected static files
| | |-myproject
| | | |-[app folders]
| | | |-requirements.txt
| | | |-static  #central static location for development
| | | |-[...]
| | | |-myproject
| | | | |-settings.py
| | | | |-[...]

settings.py (shortend)
# -*- coding: utf-8 -*- 
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1']

TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
)

TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages'
)

STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

# Application definition

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
[...]
)

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

#START addition or userauth app
INSTALLED_APPS += (
'userauth',
)
LOGIN_URL = '/benutzer/anmelden/'
LOGOUT_URL = '/benutzer/abmelden/'
LOGIN_REDIRECT_URL = '/'
#END addition or userauth app

#START Mobile Detection -> based on mobileESP
MIDDLEWARE_CLASSES += (
'mobileesp.middleware.MobileDetectionMiddleware',
)
#END Mobile Detection
INSTALLED_APPS += (
'south',
)
#fix for mysqlConector: http://www.robberphex.com/2014/02/317
SOUTH_DATABASE_ADAPTERS = {
'default': 'south.db.mysql'
}
#END addition for south DB Migration Tool

#START addition for dajax (0.6)
INSTALLED_APPS += (
'dajaxice',
'dajax'
)
STATICFILES_FINDERS += (
'dajaxice.finders.DajaxiceFinder',
)
ROOT_URLCONF = 'myproject.urls'
WSGI_APPLICATION = 'myproject.wsgi.application'

DATABASES = {
'default': {
'ENGINE': 'mysql.connector.django',
'NAME': 'myproject',
'USER': 'root',
'PASSWORD': 'tekkoadmin',
'HOST': '127.0.0.1',
'PORT': '3306'
}
}
LANGUAGE_CODE = 'de'
TIME_ZONE = 'Europe/Berlin'
USE_I18N = True
USE_L10N = True
USE_TZ = True

# Static files (CSS, JavaScript, Images)
STATIC_ROOT = '/webapps/sonar3/static/' #production
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
#'/webapps/sonar3/static/', #not jet used
)

TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
os.path.join(BASE_DIR, 'templates/desktop'),
os.path.join(BASE_DIR, 'templates/tablet'),
os.path.join(BASE_DIR, 'templates/mobile'),
)

# define if services should use multithreading
SERVICES_USE_THREADS = False

nginx.conf
upstream sonar_app_server {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a
# single worker for timing out). 
server unix:/webapps/sonar3/run/gunicorn.sock fail_timeout=0;
}
 
server {
listen 8001;
server_name myproject.de;
 
client_max_body_size 4G;
 
access_log /webapps/sonar3/logs/nginx-access.log;
error_log /webapps/sonar3/logs/nginx-error.log;
location /static {
alias /webapps/sonar3/static;
}
location /media {
alias /webapps/sonar3/media;
}
 
location / {
# an HTTP header important enough to have its own Wikipedia 
entry:
# http://en.wikipedia.org/wiki/X-Forwarded-For
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 
# enable this if and only if you use HTTPS, this helps Rack
# set the proper protocol for doing redirects:
# proxy_set_header 

Django 1.6.4 debug-toolbar confusing error

2014-05-23 Thread Florian Auer
Hi

I am running 2 django 1.6.4 projects, both with debug toolbar enabled.

The first one ist a simple project, following the a cookbook tutorial and 
the toolbar works fine inside.
The second project ist the one, I'll wnated to start the real development 
in.

But there every call to the most panels give me a 500 error:
Internal Server Error: /__debug__/render_panel/
Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\django\core\handlers\base.py", line 
114, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Python33\lib\site-packages\debug_toolbar\views.py", line 19, in 
render_panel
content = panel.content
  File "C:\Python33\lib\site-packages\debug_toolbar\panels\__init__.py", 
line 87, in content
return render_to_string(self.template, self.get_stats())
  File "C:\Python33\lib\site-packages\django\template\loader.py", line 162, 
in render_to_string
t = get_template(template_name)
  File "C:\Python33\lib\site-packages\django\template\loader.py", line 138, 
in get_template
template, origin = find_template(template_name)
  File "C:\Python33\lib\site-packages\django\template\loader.py", line 127, 
in find_template
source, display_name = loader(name, dirs)
  File "C:\Python33\lib\site-packages\django\template\loader.py", line 43, 
in __call__
return self.load_template(template_name, template_dirs)
  File "C:\Python33\lib\site-packages\django\template\loader.py", line 49, 
in load_template
template = get_template_from_string(source, origin, template_name)
  File "C:\Python33\lib\site-packages\django\template\loader.py", line 149, 
in get_template_from_string
return Template(source, origin, name)
  File 
"C:\Python33\lib\site-packages\debug_toolbar\panels\templates\panel.py", 
line 71, in new_template_init
old_template_init(self, template_string, origin, name)
  File "C:\Python33\lib\site-packages\django\template\base.py", line 125, 
in __init__
self.nodelist = compile_string(template_string, origin)
  File "C:\Python33\lib\site-packages\django\template\base.py", line 153, 
in compile_string
return parser.parse()
  File "C:\Python33\lib\site-packages\django\template\base.py", line 278, 
in parse
compiled_result = compile_func(self, token)
  File "C:\Python33\lib\site-packages\django\template\defaulttags.py", line 
806, in do_for
nodelist_loop = parser.parse(('empty', 'endfor',))
  File "C:\Python33\lib\site-packages\django\template\base.py", line 278, 
in parse
compiled_result = compile_func(self, token)
  File "C:\Python33\lib\site-packages\django\template\defaulttags.py", line 
573, in cycle
PendingDeprecationWarning, stacklevel=2)
PendingDeprecationWarning: 'The `cycle` template tag is changing to escape 
its arguments; the non-autoescaping version is deprecated. Load it from the 
`future` tag library to start using the new behavior.
[23/May/2014 11:59:50] "GET 
/__debug__/render_panel/?store_id=e6eeea46ebc04510bf489db8336adf0f_id=SettingsPanel
 
HTTP/1.1" 500 14196

the main difference is with this project, that it has a template 
dependency, using a mysql connector instead of sqlite.
>From my point of view I dont knwo whats the problem.

settings.py:
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = 'xxx'
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1']
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'cockpit',
)

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
#START addition for DEBUG-TOOLBAR
INSTALLED_APPS += (
'debug_toolbar',
)
MIDDLEWARE_CLASSES += (
'debug_toolbar.middleware.DebugToolbarMiddleware',
)
INTERNAL_IPS = ('127.0.0.1',)
#DEBUG_TOOLBAR_CONFIG = {'INTERCEPT_REDIRECTS': False} #deprecated
#END addition for DEBUG-TOOLBAR

#START addition or userauth app
INSTALLED_APPS += (
'userauth',
)

#START Mobile Detection -> based on mobileESP
MIDDLEWARE_CLASSES += (
'mobileesp.middleware.MobileDetectionMiddleware',
)
#END Mobile Detection

ROOT_URLCONF = 'myProjectName.urls'
WSGI_APPLICATION = 'myProjectName.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'mysql.connector.django',
'NAME': 'myProjectName',
'USER': 'root',
'PASSWORD': 'x',
'HOST': '127.0.0.1',
'PORT': '3306'

PyDev 3.4.1 & Django 1.7: undefined variable from Import

2014-05-12 Thread Florian Auer
Hi folks

I'am new to django and try to follow the tutorial to digg into the code.

I am using eclipse 4.3.SR2 with PyDev 3.4.1 and Django 1.7.b2 (because of 
the new features)
In Tutorial Part 3 
(https://docs.djangoproject.com/en/1.7/intro/tutorial03/) the database API 
is used to get the latest 5 objects

latest_question_list = Question.objects.order_by('-pub_date')[:5]


But my eclipse/PyDev does not resolve the objects correctly. "Question.
objects" will e resolved bot not further on. This leads to the problem that 
PyDev is claiming about a "undefined variable from import: order_by"
I know that I can turn off this in the settings, but I would like to know 
if there is a way to bring this auto-completion feature to work.

The application is running correctly an on the python shell the 
auto-completion is also working.
So therefor I would think it is a PyDev problem or did I just missed to add 
something to the config?

-- 
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/13b3436a-402e-47ef-acfd-23fdbaf5166a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Weird problem in common_settings include

2012-12-14 Thread florian


On Friday, December 14, 2012 11:17:07 AM UTC+1, ke1g wrote:
>
>
> How are you combining INSTALLED_APPS from the two files?  Note that simply 
> "setting" it to what you want to add in the file that includes the other 
> *replaces* the value you have imported from the other.  Be sure to use += 
> instead of = .
>

INSTALLED_APPS = COMMON_INSTALLED_APPS + SPECIFIC_INSTALLED_APPS

in each specific settings file
 

> Also, if you run "python manage.py shell" you can "from django.conf import 
> settings" and poke around at the values that you are actually setting, 
> which may give a clue.
>


>From the shell, INSTALLED_APPS value is as expected

 

> Finally, you can put "import pdb; pdb.set_trace()" at/near the top of one 
> or the other file and single step your way along to explore how execution 
> differs from your plan.
>

I'll try this

thanks
 

-- 
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/-/jtB-ERnacIsJ.
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: Weird problem in common_settings include

2012-12-13 Thread florian iragne
Ok, i've get rid of my "special" mobile_manage.py and pass the 
--settings option when i start the fcgi process (i use nginx+fcgi, no 
mod_wsgi).


Using manage.py, with each settings file, i can verify that the 
INSTALLED_APPS is correct and complete. However, i still get the error


any idea?

thanks

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: Weird problem in common_settings include

2012-12-13 Thread florian
Hi,

On Thursday, December 13, 2012 1:02:10 PM UTC+1, Tom Evans wrote:
>
> Er, why have two versions of manage.py? One of the arguments manage.py 
> takes is the name of your settings module. 
>
> Put all your common settings into 'settings_default.py'. 
>
> Add your mobile settings as 'settings_mobile.py' and default as 
> 'settings_default.py'. 
>
> In each of them, start the file with 'from settings_default import *'. 
> Add any overrides or other settings after that. 
>
> Run your server with "python manage.py --settings=settings_mobile" (or 
> "--settings=project.settings_mobile", depending on how your project is 
> structured. 
>
> With mod_wsgi, set the appropriate DJANGO_SETTINGS_MODULE environment 
> variable. 
>

it's exactly what i've done, except that i've two different manage.py 
instead of using --settings option
I'll try with the option instead of different manage.py
 

> Use manage.py to open a django shell. Import settings as django would 
> ("from django.conf import settings"). Is contenttypes in 
> settings.INSTALLED_APPS? 



i'll try this with my current setup and with the --settings stuff

thanks for your answer

Florian 

-- 
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/-/1slx3tgakSwJ.
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 problem in common_settings include

2012-12-13 Thread florian
Hi,

for my project, i hav a mobile_manage.py and a manage.py. Each has its 
specific settings, but has also lots of sommon settings.

Thus, i've created a common_settings.py and included it in the specific 
settings (settings.py and mobile_settings.py). Howerver, it doesn't work.

There's no error message when i start the server (either with runserver or 
using fcgi/nginx), but when i try to access the homepage i gent an 
"ImproperlyConfigured" error, telling me that django.contrib.contenttypes 
is not in my INSTALLED_APPS. It is in my INSTALLED_APPS and the debugging 
after this error (the settings displayed in the "Request Information" part) 
show that it is really defined correctly.

So, do i use it the wrong way or is this a bug?

thanks for your help

Florian

-- 
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/-/VUDCV7q6v6IJ.
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: CachedStaticFilesStorage headache

2012-10-25 Thread florian
ok, just needed to post to find the answer myself!

my STATIC_ROOT was "static/" , don't know why i haven't changed it!
now, it is os.path.join(ROOT, "static/")

and it works perfectly

I leave the post in case it would help someone

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



CachedStaticFilesStorage headache

2012-10-25 Thread florian
Hi,

i try to use CachedStaticFilesStorage and, for now, it only gives me a 
headache!

Whay i've done : 
 1 - put STATICFILES_STORAGE = 
'django.contrib.staticfiles.storage.CachedStaticFilesStorage' in setting
 2 - DEBUG = False
 3 - add  'staticfiles': {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': os.path.join(ROOT_DIR, 'staticcache'),
}
   to CACHES in settings
 4 - collectstatic
 5 - replace each occurrence of {{STATIC_URL}}/* by {% static "blabla" %}, 
with the correct {% load static from staticfiles %}

So, i've read and followed the doc

Now, the css are well modified by collectstatic. The items are well tagged 
with their md5. However, each time i access a page, i get a 500 error. In 
the logs, i have the following message :

ValueError: The file 'img/favicon.png' could not be found with 


I've search if there is more doc/howto, but didn't find anything. So i 
think i'm doing something wrong, but don't know what.

Last thing : if y use the md5-tagged version in the template, it works. 
Hence, i think that CachedStaticFilesStorage can't manage to find my assets.

any idea?

thanks

-- 
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/-/ei_OZzoffWQJ.
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: PicklingError: Can't pickle : it's not the same object as pytz._UTC

2012-06-22 Thread Florian Apolloner
Hi,

I've never ran into this and the only way I can reproduce it is: 
http://bpaste.net/show/29LVTwRDX5DIgUSDE6D9/ -- So my question to you is: 
What exactly are you doing, how are you deploying, do you have code 
reloading active somewhere?

Cheers,
Florian

-- 
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/-/ICvRqXParfgJ.
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: Language Translation

2012-03-11 Thread Florian Apolloner
Hi,

please post usage questions to django-users. Thx.

On Friday, March 9, 2012 4:23:37 PM UTC+1, Vishnu vg wrote:
>
> Hi Friends,
>
> I have a cms based existing django site. I want to translate it to german 
> or other language, Please suggest which is the best method?
>
>
> -- 
> Regards
>
> Vishnu V.G
> Software Programmer
> Mobile : 8714321452(Docomo)
>
>
>

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



DatabaseError when running unit tests after upgrade to Django 1.3.1

2011-10-30 Thread Florian Hahn
Hi,

upgrading to Django 1.3.1 somehow breaks my unit tests.

I'm using django.contrib.gis.db.backends.spatialite as a database
engine with two databases;

DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.spatialite',
'NAME': 'sqlite.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
},
'geonames': {
'ENGINE': 'django.contrib.gis.db.backends.spatialite',
'NAME': 'geonames.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}


Runserver works fine, but when I try to run some tests following error
occurs:

Installing custom SQL ...
Installing indexes ...
No fixtures found.
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
south/management/commands/test.py", line 8, in handle
super(Command, self).handle(*args, **kwargs)
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/core/management/commands/test.py", line 37, in handle
failures = test_runner.run_tests(test_labels)
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/test/simple.py", line 359, in run_tests
old_config = self.setup_databases()
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/test/simple.py", line 296, in setup_databases
test_db_name = connection.creation.create_test_db(self.verbosity,
autoclobber=not self.interactive)
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/contrib/gis/db/backends/spatialite/creation.py", line 64, in
create_test_db
if Site is not None and
Site.objects.using(self.connection.alias).count() == 1:
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/db/models/query.py", line 334, in count
return self.query.get_count(using=self.db)
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/db/models/sql/query.py", line 401, in get_count
number = obj.get_aggregation(using=using)[None]
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/db/models/sql/query.py", line 367, in get_aggregation
result = query.get_compiler(using).execute_sql(SINGLE)
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/db/models/sql/compiler.py", line 735, in execute_sql
cursor.execute(sql, params)
  File "/home/flo/.virtualenvs/django/lib/python2.7/site-packages/
django/db/backends/sqlite3/base.py", line 234, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.DatabaseError: no such table: django_site


Did anybody experience something similar?

Cheers,
Flo

-- 
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: Pango causing mod_wsgi to crash - Segmentation fault (11)

2011-10-16 Thread Florian Apolloner
Increase debug level and make sure to read the debugging docs on 
modwsgi.org; then you can hopefully provide more info, so we can actually 
help.

Cheers,
Florian

P.S.: Btw telling us which versions you use exactly would help too

-- 
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/-/TO3mdgUKtNgJ.
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: syncdb for mysql using engine=NDBCLUSTER

2011-10-16 Thread Florian Apolloner
Oh and if you don't want to create all tables in the cluster, just create 
with the default engine and then switch as needed.

-- 
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/-/YqWTj0_-_tYJ.
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: syncdb for mysql using engine=NDBCLUSTER

2011-10-16 Thread Florian Apolloner
Hi,

this can be done as documented like for the innodb backend: 
https://docs.djangoproject.com/en/dev/ref/databases/#creating-your-tables

Cheers,
Florian

-- 
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/-/gjXN-sjpQKwJ.
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: How to solve MultiValueDictKeyError

2011-09-21 Thread Florian Apolloner
Hi,

please post in django-users, this mailinglist is about the development of 
django itself, not about enduser problems.

-- 
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/-/x4TGJNjIK8YJ.
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: How to I create download link of some file using django

2011-05-26 Thread Florian Apolloner
Hi,

file.url is what you are looking for (assuming MEDIA_URL is configured
correctly)

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



Access queryset in get_context_data()?

2011-05-24 Thread Florian Hahn
Hi,

is there a way to access queryset from get_context_data without
executing the query twice in a class based view?

cheers

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



using dumpdata on an application with non managed models

2010-06-18 Thread Florian Le Goff
Hi,

I'm trying to run dumpdata on an application which use severals non-
managed models. For example:

class testModel(models.Model):
class Meta:
managed = False

Unfortunately, when I run ./manage.py dumpdata myapp ; the following
happens :

Traceback (most recent call last):
  File "./manage.py", line 11, in 
execute_manager(settings)
(...)
django.db.utils.DatabaseError: no such table: myapp_testmodel


1. Am I wrong to expect that dumpdata should follow the managed =
False instruction and not attempt to load data from this non-existant
table ?

2. Does anyone has a suggestion on how to proceed ? Any solution not
involving listing each of the impacted models in --exclude will be
welcome.


Thanks,

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



Partial ModelForm produces empty var on ManyToMany relationship

2010-04-27 Thread Florian Le Goff
Hi,

I'm using Django's 1.1.1 official release and I'm trying to build a
partial form, using ModelForm, with only one field, of the
ManyToManyField type.

If my partial form's Meta class "fields" attribute contains several
attributes names, everything is working pretty smoothly. My form is
produced, the template rendering is allright, and I'm able to fetch
the values and save them using this partial form and request.POST .

Unfortunately, if I try to set the field attribute of my partial form
to only one attribute (the ManyToManyField previously mentioned), I'm
getting an empty form.

I'm calling my class this way :

item = get_object_or_404(ItemChild, pk=item_id,)
form_item_select = ItemPartialParent(instance=item)

And here is my model :

class ItemChild(models.Model):
name = models.CharField(max_length=120)

def __unicode__(self):
return self.name

class ItemParent(models.Model):
name = models.CharField(max_length=120)
children = models.ManyToManyField(ItemChild)

class ItemPartialParent(ModelForm):
class Meta:
model = ItemParent
# working ok :
#  fields = ('children' , 'name')
# a call to ItemPartialParent() returns nothing :
fields = ('children')

I am doing something wrong ?

Did anyone run into this already ?

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



Re: Cassandra back end for Django

2010-03-04 Thread Florian Leitner
One possible solution: write your own Cassandra "O-non-R-M API"
separtely from Django and use the Django DB backend only for less
high-volume data - or not at all - and the Django web framework to
display the data (i.e., only implement views, forms, etc. in Django).
An example of such a layout (not using models at all) was set up by
Eric Florenzano for a "twitter clone site", twissandra:

http://github.com/ericflo/twissandra

Not sure that's what you want, but maybe it inspires. Otherwise, there
are some guys working on implementing a Django object mapper for
Cassandra, I _think_, but I have no idea about the stage of that
project.

--fnl

On 3 March 2010 17:32, Oshadha  wrote:
> Hia fellas,
>
> I'm kind of new to Django framework.as far as I know Django only
> supports four major database engines.I have a requirement to use
> Cassandra(http://incubator.apache.org(/cassandra/) as the database
> backend,but I couldn't find any good resources on the net that give a
> helping hand.So I need a help form you guys.If anyone know a good
> resources for implementing Cassandra with Django framwork please post
> it here and share your experience on these technologies if you have
> any.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Apache WSGI DJANGO

2009-10-13 Thread Florian Strzelecki
I think the problem is not in your wsgi file, but in your apache's vhost
configuration.
You should have this in your vhost configuration, to use your django
application with mod_wsgi :

WSGIScriptAlias / /var/www/conf/myconf.wsgi

So, you should add this line (if your admin/media is url /admin/media, you
can override this in your project's settings file, with ADMIN_MEDIA_PREFIX)
:

Alias /admin/media
/usr/lib/python2.5/site-packages/django/contrib/admin/media

As you could have this for other local media :

Alias /media /var/www/media

All path depend on your installation, of course. :)

F.


2009/10/13 Nilesh Patel 

> here is my apache config file for wsgi,
>
> import os, sys
> apache_configuration= os.path.dirname(__file__)
> project = os.path.dirname(apache_configuration)
> sys.path.append('/var/www')
> sys.path.append('/var/www/myproj/cms')
> os.environ['DJANGO_SETTINGS_MODULE'] = 'myproj.settings'
> import django.core.handlers.wsgi
> from django.conf import settings
> settings.DEBUG=False
> application = django.core.handlers.wsgi.WSGIHandler()
>
>
>
> 2009/10/11 Kenneth Gonsalves 
>
>>
>> On Sunday 11 Oct 2009 12:14:13 pm lafada wrote:
>> > Apache says,
>> >
>> > File does not exist: /var/lib/python-support/python2.5/django/contrib/
>> > admin/media/js/actions.js
>> >
>> > When I tried to locate server says,
>> > /usr/lib/python2.5/site-packages/django/contrib/admin/media/js/
>> > actions.js
>> >
>> > what may be the cause ???
>>
>> you have not given the correct path to django/contrib/admin in your apache
>> config.
>> --
>> regards
>> kg
>> http://lawgon.livejournal.com
>>
>>
>>
>
>
> --
> #Japan Shah
> Sent from Gujarat, India
> >
>

--~--~-~--~~~---~--~~
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: how to get back to a view requiring login

2009-10-11 Thread Florian Schweikert
2009/10/12 Sergio A. <sergio.andreo...@gmail.com>

>
> 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 <kelvan.mailingl...@gmail.com>

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



Using COMMENTS_APP setting

2009-06-03 Thread Florian Lindner

Hello,

following http://aartemenko.com/texts/optional-email-in-django- 
comments/ I try to configure comments in a way that the email address  
is not required.

I changed my settings.py

INSTALLED_APPS = (
[...]
 'xgm.Blog.comments',
 )

COMMENTS_APP = 'xgm.Blog.comments'

xgm/Blog/comments.py (is it ok to use a py-file as app?):

from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.comments.forms import CommentForm

class BlogCommentForm(CommentForm):
 email = forms.EmailField("Test!!", required=False)

def get_form():
 return BlogCommentForm

but this simply changes nothing (at least nothing I see). The email  
field is still required and the label (changed for testing purpose) is  
still the same.

I render the comment form in a template with:

{% render_comment_form for object %}

What is wrong about my way?

Thanks,

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



contrib.comments: blank email

2009-06-01 Thread Florian Lindner

Hello,

so far I understand the contrib.comments.models:

  user_email  = models.EmailField(_("user's email address"), blank=True)

The email field of a comment is not needed. Though my preview.html  
template (hat I've copied from the vanilla template and made only  
design modifications) complains that the email field is compulsory.  
Anything still wrong with my setup or do I misunderstand something?

Thanks,

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: updating dependent page from an iframe

2009-04-23 Thread Florian Strzelecki
I think this is a basic html's problem, and, I'll suppose that you absolutly
need an iframe on your site.

So, when you make something in an iframe, the another have to be reloaded.
With Javascript, or another way...

And if you don't want to reload the entire iframe, use Ajax technologie...

Hm... but... are you sure you need an iframe ? :x

2009/4/23 snorkel 

>
> Hi,
>  I have a page with an iframe which contains operations on model data
> such as adding /deleting etc
> and the rest of the page which has a clickable list of all the items.
>  However when you add or delete an item via the ifame the list does
> not update.
> Should I be using reload or is there another method?
>
> Thanks
> >
>

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



Re: Writing csv files to server

2009-04-23 Thread Florian Strzelecki
Hm... in my opinion this isn't a Django problem, but a conception problem.

I think you need a "state" on the invoices : when does it have been paid ?
If you know when, so you can filter on the date of paiement.

Exemple :

Paid (id-1, sales-1, date_paid-2009-03-02, value-$150)
Paid (id-1, sales-1, date_paid-2009-03-24, value-$100)
Paid (id-2, sales-1, date_paid-2009-04-02, value-$400)

And, in another table, you could have this :

Invoice (id-1, client-1, value-$650, is_paid-1)

At 2009-03-25 you can say : the client have paid $350, remain $400.
At 2009-04-12 you can say : the client have paid $650, remain $0

And, if you want, at 2009-05-06 say "at 2009-03-25 what was the state of
this sales ?" : you are able to give this information !

2009/4/23 Alfonso 

> Does anyone have a better suggestion and how would I start writing to
> csv on server.
>

--~--~-~--~~~---~--~~
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: Pass subdomain to a view function.

2009-04-09 Thread Florian Strzelecki
And what about use the "request" parameter ?
Link :
http://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.get_host

You can use the request.get_host() to know what is the host using, and so
make what you want (some split and catch the first part "user1").

2009/4/9 Rodrigo C. 

>
> Is there a way to catch a subdomain and pass it to a view function?
>
> For example, if I have a site "sitename.com", and a user called
> "user1", I would like to be able to have "user1.sitename.com" be
> hooked into the user's profile, for example, so I'd need to be able to
> pass the subdomain to my view function.
> The site will be hosted on Webfaction, if that makes a difference.
>
> Thanks,
>
> Rodrigo
> >
>

--~--~-~--~~~---~--~~
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: Igoogle integration

2009-04-09 Thread Florian Strzelecki
Hello, I think you could use this :
http://docs.djangoproject.com/en/dev/topics/http/urls/#passing-extra-options-to-view-functions

You can give some parameters to your view function, defined into the url
pattern.
So, when it's /mycooldfeed you will write {'template':
'normal_template.tpl'} and when it's /embed/mycooldfeed/ you will write
{'template': 'embed_template.tpl'}

Or something like that...
But may be someone have a better idea.

2009/4/9 Nick Boucart 

>
> Ideally, I would like to have a urls like:
> /mycoolfeed and /embed/mycoolfeed that both fetch exactly the same
> data from the database, but render a different template based upon the
> url.
>
> How would you do 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
-~--~~~~--~~--~--~---



Re: mod_python error

2009-04-07 Thread Florian Strzelecki
And... what about that :

DocumentRoot:   '/usr/local/apache2/htdocs'

URI:'/contact.php'
Location:   '/'
Directory:  None
Filename:   '/usr/local/apache2/htdocs/
contact.php'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Are you trying to serve a php file with mod_python ?
If you see what I meen. :]

--~--~-~--~~~---~--~~
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: select_related and 1-to-many relations

2009-04-07 Thread Florian Strzelecki
Hm... something like that :
http://docs.djangoproject.com/en/dev/topics/db/queries/#backwards-related-objects
You can reverse a relationship, using "u.*att*_set".

--~--~-~--~~~---~--~~
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: Beginner's Help needed

2009-04-05 Thread Florian Strzelecki
Yes you can !

*WSGI :*

Alias /another /path/to/your/phpApplication
WSGIScriptAlias / /path/to/file.wsgi

*MOD_PYTHON :*

Use Location apache directive.
I don't remember what to do for php... sorry, but I know that on this way.


2009/4/5 Dougal Matthews 

> It depends how you mean combine really. You can have them both running on
> the same server, you can have them share the same database (then you can
> still manage it with django)
> Dougal
>
>
> ---
> Dougal Matthews - @d0ugal
> http://www.dougalmatthews.com/
>
>
>
> 2009/4/5 atik 
>
>
>> Ok. Again Thanks. I will do it.
>> Can i combine django application with PHP?
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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: Best JS Library compatibility for Django

2009-04-05 Thread Florian Strzelecki
Hm... look at this :
http://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.is_ajax

HttpRequest.is_ajax()¶
New
in Django 1.0: *Please, see the release
notes*

Returns True if the request was made via an XMLHttpRequest, by checking the
HTTP_X_REQUESTED_WITH header for the string 'XMLHttpRequest'. The following
major JavaScript libraries all send this header:

   - jQuery
   - Dojo
   - MochiKit
   - MooTools
   - Prototype
   - YUI

If you write your own XMLHttpRequest call (on the browser side), you'll have
to set this header manually if you want is_ajax() to work.


2009/4/5 Alex Gaynor 

>
>
> On Sun, Apr 5, 2009 at 4:02 PM, lodmod@gmail.com  > wrote:
>
>>
>> What are some JS libraries that people have had good experience with
>> using in conjunction with Django webapps?
>>
>>
>>
> Django will work perfectly fine with any javascript library you choose to
> use.  That being said I personally like jQuery because of its simple API.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
>
>
> >
>

--~--~-~--~~~---~--~~
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: How can I filter query sets in a django template?

2009-04-05 Thread Florian Strzelecki
Did you try to look at Inclusion Tag ?
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags

In template you are not allowed to use some python code... but with an
inclusion tag, you will be able to write this :

{% load related_conferences %}
{% related_conferences scientist %}

And your inclusion tag may be this :

@register.inclusion_tag('path/to/tag/related_conferences.html')
def related_conferences(scientist):
# define here list_of_conferences
return {'list': list_of_conferences}

The inclusion tag have been created for this : move python code into python
file ! Not into template files.

I hope this will help you.
And sorry for my English, I'm french. :)


2009/4/5 codecowboy 

>
> I posted a question earlier today about circular imports (http://
> groups.google.com/group/django-users/t/6119e979131c8c25).  I now have
> a follow question to that.  I've got the following view logic.
>
> def portal(request):
>scientist_id = 1
>s = get_object_or_404(Scientist, pk=scientist_id)
>return render_to_response('scientists/portal.html',
> {'scientist':s})
>
> Now, Scientists are related (many-to-many) to Conferences through
> ConferenceAttendee.  Both of these models are created in a different
> app.  I won't paste them in unless someone needs to see them in order
> to answer my question.
>
> I only want to loop through conferences that this scientist is
> presenting.  (ConferenceAttendee.presenter=True).  I have tried
> following the docs (http://docs.djangoproject.com/en/dev/topics/db/
> queries/#field-lookups-intro),
> but it seems that you can only call the
> filter method in python files like views.py or models.py.  I've tried
> replacing the loop code below with "for ...conference._set.filter(...)
> but python gives me errors when I do that.  Here is my template logic.
>
> Your Presentations
>
> 
>{% for conference in scientist.conference_set.all %}
>
> {{ conference.title }}
>{% endfor %}
>
> 
>
> I've been stuck on this one for days now so any help would be greatly
> appreciated.  Please do point me to any articles that I may have
> missed that already answer this post.
>
> Thank you,
>
> Guy
> >
>

--~--~-~--~~~---~--~~
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: Changing comments preview form

2009-01-29 Thread Florian Lindner


Am 29.01.2009 um 01:59 schrieb Malcolm Tredinnick:

>
> On Wed, 2009-01-28 at 19:24 +0100, Florian Lindner wrote:
>>
>> Am 28.01.2009 um 05:19 schrieb Malcolm Tredinnick:
>>
>>>
>>> On Tue, 2009-01-27 at 20:11 +0100, Florian Lindner wrote:
>>>> Hello,
>>>>
>>>> I'm playing around with the contrib.comments framework. I want to
>>>> change the preview form. For that I've copied preview.html to xgm/
>>>> Blog/
>>>> templates/comments (xgm is my project, Blog is app). My template
>>>> loaders are:
>>>>
>>>> TEMPLATE_LOADERS = (
>>>>'django.template.loaders.app_directories.load_template_source',
>>>>'django.template.loaders.filesystem.load_template_source',
>>>> )
>>>>
>>>> But modification I make to the preview.html in my app dir does not
>>>> seem to be noticed.
>>>
>>>
>>> For comments, if you're only wanting to change the preview form  
>>> for a
>>> particular model or particular application, note that the template
>>> loaded for preview is not comments/preview.html, always. That is the
>>> name that is loaded is all else fails. However, the application  
>>> first
>>> looks for
>>>
>>>   comments/__preview.html
>>>   comments/_preview.html
>>>
>>> where  is the name of the application and  is the name  
>>> of
>>> the model to which the comment is attached. If either of those
>>> templates
>>> are found, they are used for preference. So for an app-specific
>>> customisation for an app called "foo", say, you could create
>>>
>>>   comments/foo_preview.html
>>>
>>> in the foo/templates/ directory and it will be loaded for the  
>>> preview.
>>
>> Hi!
>>
>> Thanks for your answer. I decided to take the latter way. Thus I've
>> copied preview.html to Blog_Entry_preview.html in the templates/
>> comments/ directory and it worked perfectly. I tried the same copying
>> with the posted.html to Blog_Entry_posted.html but this does not  
>> work.
>> My Blog_Entry_posted.html simply seems to be ignored.
>>
>> Any idea what I could have made wrong? I've double checked  
>> everything...
>
> So, for the future: It took about 30 seconds to grep through the
> comments source (in django.contrib.comments) to find where posted.html
> is used and see that it's doesn't allow that customisation (which is
> also how I found that preview.html is the third of three things
> checked).
>
> Remember, Django is in Python. The source is your friend.

Ok, you're right. I've searched through Google but didn't got the idea  
to grep the code. My apologies.
Is there any reason why this lookup is not implemented for all  
comments templates? If not I'll try to create a patch and commit into  
the ticket system.

Regards,

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: Changing comments preview form

2009-01-28 Thread Florian Lindner


Am 28.01.2009 um 05:19 schrieb Malcolm Tredinnick:

>
> On Tue, 2009-01-27 at 20:11 +0100, Florian Lindner wrote:
>> Hello,
>>
>> I'm playing around with the contrib.comments framework. I want to
>> change the preview form. For that I've copied preview.html to xgm/ 
>> Blog/
>> templates/comments (xgm is my project, Blog is app). My template
>> loaders are:
>>
>> TEMPLATE_LOADERS = (
>> 'django.template.loaders.app_directories.load_template_source',
>> 'django.template.loaders.filesystem.load_template_source',
>> )
>>
>> But modification I make to the preview.html in my app dir does not
>> seem to be noticed.
>
>
> For comments, if you're only wanting to change the preview form for a
> particular model or particular application, note that the template
> loaded for preview is not comments/preview.html, always. That is the
> name that is loaded is all else fails. However, the application first
> looks for
>
>comments/__preview.html
>comments/_preview.html
>
> where  is the name of the application and  is the name of
> the model to which the comment is attached. If either of those  
> templates
> are found, they are used for preference. So for an app-specific
> customisation for an app called "foo", say, you could create
>
>comments/foo_preview.html
>
> in the foo/templates/ directory and it will be loaded for the preview.

Hi!

Thanks for your answer. I decided to take the latter way. Thus I've  
copied preview.html to Blog_Entry_preview.html in the templates/ 
comments/ directory and it worked perfectly. I tried the same copying  
with the posted.html to Blog_Entry_posted.html but this does not work.  
My Blog_Entry_posted.html simply seems to be ignored.

Any idea what I could have made wrong? I've double checked everything...

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



Changing comments preview form

2009-01-27 Thread Florian Lindner

Hello,

I'm playing around with the contrib.comments framework. I want to  
change the preview form. For that I've copied preview.html to xgm/Blog/ 
templates/comments (xgm is my project, Blog is app). My template  
loaders are:

TEMPLATE_LOADERS = (
 'django.template.loaders.app_directories.load_template_source',
 'django.template.loaders.filesystem.load_template_source',
)

But modification I make to the preview.html in my app dir does not  
seem to be noticed.

What's wrong?

Thanks,

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: Invalid block tag: "get_comment_count"

2009-01-21 Thread Florian Lindner


Am 20.01.2009 um 21:40 schrieb Florian Lindner:

>
>
> Am 19.01.2009 um 22:58 schrieb Briel:
>
>>
>> You should try playing around with the tags, trying to load comments
>> different places trying some of the other comment tags to see what
>> happens ect.
>> Also are you using the block tags? what block tags do you have where
>> have you placed them in relation to your code?
>
> Hi!
> I've stripped down my code to merely these two lines:
>
> {% load comments % }
> {% get_comment_count for object as comment_count %}

Well, I got it now. It was one whitespace too much: {% load comments  
%} vs. {% load comments % }.



--~--~-~--~~~---~--~~
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: Invalid block tag: "get_comment_count"

2009-01-20 Thread Florian Lindner


Am 19.01.2009 um 22:58 schrieb Briel:

>
> You should try playing around with the tags, trying to load comments
> different places trying some of the other comment tags to see what
> happens ect.
> Also are you using the block tags? what block tags do you have where
> have you placed them in relation to your code?

Hi!
I've stripped down my code to merely these two lines:

{% load comments % }
{% get_comment_count for object as comment_count %}

Nothing more. but the error is still there.

--~--~-~--~~~---~--~~
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: Invalid block tag: "get_comment_count"

2009-01-19 Thread Florian Lindner


Am 19.01.2009 um 22:04 schrieb Briel:

> It's hard to say what's going wrong with the code you provided, but I
> can say a few things. Since you don't get an error from {% load
> comments %}, there should be no problems with the installation.
> However, you might not actually run the command in the template, it
> could be that you are writing it over with an extend tag. The error
> hints that get_comment_count is an invalid tag, so you should test if
> comments is loaded probably in your template.
> Try loading comments directly above your tag and see what happens and
> take it from there.

Hi!

The complete code is:

{% load comments % }


{% get_comment_count for object as comment_count %}

So I don't there is much that could have introduced an error. I extent  
an base template but it doesn't make any use of something called  
comment actually it does not use any non-trivial Django markup.

How can I test the comments is loaded properly?

Thanks,

Florian



>
>
> -Briel
>
> On 19 Jan., 21:01, Florian Lindner <mailingli...@xgm.de> wrote:
>> Hello,
>>
>> I'm trying to use the comment framework from Django 1.0.2.
>>
>> I've followed all the steps 
>> inhttp://docs.djangoproject.com/en/dev/ref/contrib/comments/
>>   (added it to installed apps, added to urls.py and loaded in the
>> template: {% load comments % }) but I get:
>>
>> TemplateSyntaxError at /blog/1/
>> Invalid block tag: 'get_comment_count'
>>
>> from:
>>
>> {% get_comment_count for object as comment_count %}
>>
>> object has just been created so probably no comment yet attached.
>>
>> What could have went wrong there?
>>
>> Thanks!
>>
>> 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
-~--~~~~--~~--~--~---



  1   2   >