Re: SyntaxError: positional argument follows keyword argument

2019-08-08 Thread Andreas Hasenkopf
t > >def breg(request): >form = UserCreationForm() >return render(request=request, template_name="source/breg.html", >{'forms':form}) > > I get the following error > >SyntaxError: positional argument follows keyword argument > > Please can anyone

Custom ManyRelatedManager?

2019-08-05 Thread Andreas Hasenkopf
call e.g. `Reference.objects.get_o_create(...)` at the same time, the locks work as expected. But e.g. calling `request.references.set(...)` can fail (unique constraint violation) in the second Celery task due to a race condition, that I would like to avoid using locks. Thanks for your help. An

Re: Django Application logging --

2019-07-22 Thread Andreas Schosser
Kurs 10 IT-Consulting www.kurs-10.de Andreas Schosser a...@kurs-10.de Baldestraße. 14 Telefon +49 89 41615842-0 80469 MünchenTelefax +49 89 41615842-3 0x85475B6B - 79BB 94F9 8523 0180 E2E5 7A8F

Re: Forbidden (CSRF token missing or incorrect.)

2018-11-29 Thread Andreas Schosser
may check, how you access your sites, by http or https. Greetings, Andreas >> I've been using Django 2.2Dev for a while now, since April 2018, and it is >> working just fine (I got my reasons why Django Dev). But since the last git >> pull, it shows the CSRF token missi

Re: static files not found on development server

2017-07-06 Thread Andreas Schosser
Hi Alex > On development, I run the django-admin runserver, which AFAIK should take > care of the static path. Did you restart the development server. I think the static files are collected at startup and newly added files are not recognized on the fly. Andreas -- Kurs 10 IT-Cons

Re: Let's Encrypt installation fails with WSGI on Ubuntu 14 LTS

2017-04-11 Thread Andreas Schosser
conf and enabled them afterwards in the le-ssl.conf: WSGIScriptAlias WSGIDaemonProcess WSGIProcessGroup Hope this helps, Andreas -- Kurs 10 IT-Consulting www.kurs-10.de Andreas Schosser a...@kurs-10.de Baldestraße. 14

Re: django angular

2017-03-03 Thread Andreas Kuhne
Hi Mohamed, I would start by looking at some of the tutorials for django rest framework - because you will need to have a format like json to communicate from angular to the database. Checkout : http://www.django-rest-framework.org/ I would also recommend looking at the tutorials on angular : htt

Re: good 404 vs bad 404

2017-03-01 Thread Andreas Kuhne
I think you should always report a 404 as a 404 regardless of the situation. The application shouldn't have to know if it is a valid 404 or an "invalid" - because from the applications point of view, the page (or item) couldn't be found. Just my 2 cents. Regards, Andréas 2017-03-01 10:25 GMT+0

Re: good doc and example on how to use bootstrap with DJango

2017-02-01 Thread Andreas Kuhne
Great to see that I could be of help :-) Regards, Andréas 2017-02-01 21:35 GMT+01:00 Thames Khi : > Thank you so much, you are a legend, sir! I can now continue my learning > and combine my python database code with django. > > I am very grateful, thank you for taking the time to explain this t

Re: good doc and example on how to use bootstrap with DJango

2017-02-01 Thread Andreas Kuhne
The setting you have to specify are: STATIC_URL and STATIC_ROOT. STATIC_URL is the url base for creating paths for the webserver to the static files. Usually you just leave this at '/static/' - however you could also set this to a completely different domain (if for example you were serving stati

Re: good doc and example on how to use bootstrap with DJango

2017-02-01 Thread Andreas Kuhne
Hi, You will have to follow the following information: https://docs.djangoproject.com/en/1.10/howto/static-files/ Make sure that the css files and js files are in the static directory. Then you can use {% static "css/bootstrap.min.css" %} for the filepath to the static files. The static files sho

Re: Moving from django 1.3 to 1.9

2017-01-27 Thread Andreas Kuhne
I second this. Having moved from 1.3 to 1.9 in stages - I think this is the best way to do it. Upgrade one minor version at a time and it will probably be easiest. Regards, Andréas 2017-01-27 10:55 GMT+01:00 ludovic coues : > You might have an easier time upgrading from one version to the next.

Re: Django and timezones ... how to initialize a field to now() in the in clients time zone?

2017-01-22 Thread Andreas Kuhne
Hi, The problem here is as you say, your server doesn't know the clients timezone. This isn't trivial to find out either. I can help you with some pointers though: 1. ALWAYS save all times in the database in UTC. ALWAYS - never diviate from this - one exception - if you are running a server that w

Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread Andreas Kuhne
What does the project structure look like? Is Stranvr the name of the project? It looks to me like you haven't created an app - or have you called your app "db_testing" and the project "Stranvr"? Because you first have to create you project with "django-admin.py startproject " and then within th

Re: Problem in django tutorial 5 , 1044 Access denied for user @'localhost' database error

2017-01-12 Thread Andreas Kuhne
You need to have the database create permission as well. Otherwise django can't recreate the database. What happens when you start the tests is that the database is dropped and recreated each time. Regards, Andréas 2017-01-12 10:24 GMT+01:00 Shashank Yadav : > Hello, > > I am working on tutoria

Re: Problem with redis on AWS and transition to dynamodb

2016-12-06 Thread Andreas Kuhne
k something is proxying your request to redis.example.com and > this something is what gives you timeouts and connection errors. > > On 6 Dec 2016, at 17:41, Andreas Kuhne wrote: > > Hi, > > Thanks for you answer - I don't think the problem is with django either, > but

Re: Problem with redis on AWS and transition to dynamodb

2016-12-06 Thread Andreas Kuhne
project and it works fine. Here're the docs about > session engines: https://docs.djangoproject.com/en/1.10/ > topics/http/sessions/#using-cached-sessions > > On 6 Dec 2016, at 15:55, Andreas Kuhne wrote: > > Hi, > > We are having a strange problem with our redis el

Problem with redis on AWS and transition to dynamodb

2016-12-06 Thread Andreas Kuhne
Hi, We are having a strange problem with our redis elasticache instances on AWS. We have our sessions stored in a redis cluster on AWS. Our webservers sometimes get a: * Error connecting to redis.example.com:6379. timed out * Timeout reading from socket (I haven't included our real domain for the

Re: External access

2016-11-07 Thread Andreas Kuhne
Do you have "ALLOWED_HOSTS" correclty configured in django settings? Regards, Andréas 2016-11-07 14:48 GMT+01:00 bob gailer : > I am running a the django server, listening at port 8000. I can access the > server using localhost. When I try using my external ip address I get "The > server at 24.

Re: Django FORM for India Postal Address

2016-11-06 Thread Andreas Kuhne
Hi, There is a plugin called django-smart-selects, that enables you to get information from the server based on information in a select field. You could try that? The form_valid() method and clean methods where you can VALIDATE such information is only called when posting the form (as you have fou

Re: can't create django project using Windows command prompt!

2016-10-05 Thread Andreas Kuhne
Hi, First make sure that you have a valid virtual environment - it's the easiest way to run python code. When that is working, you can just write : "python django-admin.py startproject mySite" - your problem is that .py files have been associated with notepad ++, and therefore it opens the file t

Re: Using sessions in Django

2016-09-24 Thread Andreas
Thanks for the help, although i get an error, saying "DataError: value too long for type character varying(2000)" when i am trying to save the "Session.objects.get(session_ key=request.session.session_key)". I checked my db and the "session_id" column is varchar(40) (which is the default value

Re: django group authentication

2016-09-20 Thread Andreas Kuhne
2016-09-20 1:36 GMT+02:00 sum abiut : > Hi, > i am building an app using django, on login i want django to check for > users in a group before login users. > For example, i want to redirect users from a group to page when they > login. > > please advise the best way to approached this. > > cheers

Re: A public cloud with django backend

2016-09-16 Thread Andreas Kuhne
2016-09-15 9:21 GMT+02:00 Rahul Doshi : > Hi ,I want to setup a dropbox like server with django. So far i have > achieved uploading files onto a location .I want these files to show up on > browser which they do(while saving file to the location I indexed an entry > in the Db so i just print the

Re: Maintaining old django code

2016-09-06 Thread Andreas Kuhne
2016-09-06 16:07 GMT+02:00 Andromeda Yelton : > +1 to Erik's plan. > > In deciding whether to stop at 1.8 or go all the way to 1.10 I'd ask > myself the following questions: > > * Are there features from 1.10 (that aren't in 1.8) that I'd really like > to have? (channels is the big one for me) > >

Re: Maintaining old django code

2016-09-06 Thread Andreas Kuhne
2016-09-06 10:57 GMT+02:00 Erik Cederstrand : > > > Den 6. sep. 2016 kl. 10.20 skrev Lekan Wahab : > > > > Good morning guys. > > I was handed a project at work which was written as far back as 2012. > > Quiet a lot of the packages used in the project are either no longer > being maintained. > > R

Re: Clarifying Project vs Apps

2016-08-24 Thread Andreas Kuhne
2016-08-24 21:09 GMT+02:00 Andromeda Yelton : > My feeling/practice on apps is: each app is a one-word informative noun. > It contains the models that are logically grouped under that noun (and the > views, urls, etc required to interact with those models on the front end). > > If there isn't a si

Re: Running Django Project Locally

2016-08-24 Thread Andreas Kuhne
2016-08-24 17:54 GMT+02:00 Michael Macdonald : > Interestingly enough, just this morning, after a couple times being bitten > with differences in behavior between use of runserver in development vs. > wsgi in production, I've decided to do all development on my local machine > under lighttpd. In

Re: Clarifying Project vs Apps

2016-08-24 Thread Andreas Kuhne
2016-08-24 19:12 GMT+02:00 Lee Hinde : > On Wed, Aug 24, 2016 at 9:23 AM, Rich Shepard > wrote: > >> On Wed, 24 Aug 2016, Lee Hinde wrote: >> >> My tuppence. >>> >> >> Lee, >> >> Before or after Brexit? The value might change. :-) >> >> No, an app is a logical grouping of objects/tables. You mi

Re: Launching websites

2016-08-09 Thread Andreas Kuhne
Hi, I don't know what level you are interested in, but I think this course will be interesting: https://www.kickstarter.com/projects/mikeckennedy/python-for-entrepreneurs-video-course It'll probably contain some of the items you are requesting. Regards, Andréas 2016-08-09 12:59 GMT+02:00 : >

Re: Please another problem

2016-08-08 Thread Andreas Kuhne
Hi Timothy, There aren't any errors in the trace you are showing. There is a missing file however (404 error), that is the favicon.ico, which browsers try to fetch from the root URL if nothing is set in your html header. To resolve that, all you have to do is add a link to a favicon file. Check th

Re: Testing if a view have an html element with at least one attribute

2016-07-31 Thread Andreas Kuhne
code, 200) > doc = etree.HTML(response.content) > > self.assertEqual(len(doc.findall('.//input[@name="username"]')), 1) > > > > 2016-07-31 17:46 GMT+02:00 Andreas Kuhne : > > 2016-07-31 15:59 GMT+02:00 ludovic coues : > >> > >> Oh, sorry.

Re: Testing if a view have an html element with at least one attribute

2016-07-31 Thread Andreas Kuhne
plication. > > 2016-07-31 14:46 GMT+02:00 Andreas Kuhne : > > 2016-07-31 13:56 GMT+02:00 ludovic coues : > >> > >> First, thanks for the suggestion. > >> > >> I just tried that, didn't work. > >> Here is the test file I us

Re: Testing if a view have an html element with at least one attribute

2016-07-31 Thread Andreas Kuhne
ml=True) > > I could copy/past the input directly in my test but if the maxlength > or class attribute change, the test will break. Taking the input > directly from the django form will test if the django form is rendered > in the view, not if the view is displaying a suitable form. >

Re: Testing if a view have an html element with at least one attribute

2016-07-31 Thread Andreas Kuhne
2016-07-31 12:38 GMT+02:00 ludovic coues : > Hello, > > I am trying to test if a view is displaying a form with an input > element with name=username. > > Currently, I have tried a lot of variation around > `self.assertContains( response, "", > html=True)` but none work. > I assume that doesn't wo

Identity management in Django

2016-05-22 Thread Andreas Jung
g of login trial, mechanisms for protecting the site from bots or automatic password hacker scripts etc) Andreas -- 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, sen

Re: Deploy Django to Heroku - Push rejected

2016-03-19 Thread Andreas Kuhne
Hi, You haven't created the app in the correct heroku way. You have to have a base django project structure. So the following changes I would suggest: 1. Use the standard layout for settings. So a settings.py file with the PRODUCTION settings in and it will find that file. Also make sure you have

Re: NAS using Django

2016-03-09 Thread Andreas Kuhne
Hi Vayuj, I think you have to be a bit more specific. Django is a web framework, used for creating web applications and websites. A NAS is usually an array of harddrives that has different file sharing protocols attached (for example SMB or NFS). It would be possible to implement something like A

Re: variable to a template

2016-03-02 Thread Andreas Schosser
Hi Luca, > height="100" Try {% static "mysite/scorr/"|add:a %} Andreas -- Kurs 10 IT-Consulting www.kurs-10.de Andreas Schosser a...@kurs-10.de Baldestraße. 14 Telefon

Re: Home Page

2016-02-24 Thread Andreas Kuhne
Malik, I find that in many of your questions you are thinking a bit too hard. If you want to have a view for the default page (home page) on a website, just create an app that will handle those pages. In one project that I am currently working on, we created an app called website. In that app we

Re: context dictionary

2016-02-23 Thread Andreas Kuhne
True, didn't know that it was active in that way nowadays. To Malik: Don't use user as a key in the dictionary. Regards, Andréas 2016-02-23 16:01 GMT+01:00 : > Wouldn't including the name 'user' in your context dictionary override the > authenticated user object in your template? Might make for

Re: context dictionary

2016-02-23 Thread Andreas Kuhne
Hi, All you have to do is add what you want to the dictionary that you need for your template. There isn't anything "magic" about the context. So for example, if you want to have a model called "user" in the template, you can add it by writing: context = {} context['user'] = User.objects.get(pk=u

Re: Migrate Data from Django 1.4 to Django 1.8

2016-02-22 Thread Andreas Kuhne
Hi, I did that a while back, I wrote my own SQL migration script that we tested with the production database in development. I think that would be the only way. Django doesn't know of the changes that you have made in your database models. However if you had started with the production database an

Re: Bug or unaccepted behaviour

2016-02-14 Thread Andreas Kuhne
Hi, Would need to see more of you code to understand exactly what you want to do. Regarding your question. It doesn't make sense, but I think you are asking the difference between "u.theme_id = self.id" and "u.theme = self"? I don't know exactly the difference, but I do know that you shouldn't ha

Re: Django Multiple User Login

2016-02-11 Thread Andreas Kuhne
You can't? Not without logging out the previous user. The session itself is used to contain a reference to the current user. You can only have one session to a certain domain (for example www.example.com and app.example.com are 2 different domains). The only way for the other user to login is to

Re: How to update a live / deployed Django project?

2016-02-10 Thread Andreas Kuhne
The thing is, you should be able to catch those issues when migrating locally on you development machines. In that case, just fix the migration and then it should work perfectly in production. You can always add certain values in the migration scripts themselves. Regards, Andréas 2016-02-10 14:5

Re: How to update a live / deployed Django project?

2016-02-10 Thread Andreas Kuhne
Hi, What I tend to do when deploying is: 1. Create a fabric script that contains a reference to the server that should be updated (defaults to dev server). 2. Use git archive to zip the contents of a git tag to a local file. 3. Upload the file to the server 4. Stop the uwsgi process 5. Update file

Re: count

2016-01-26 Thread Andreas Schosser
Hi > i am trying to count the number of fields that has request field begin > checked and then display the value of count in a template.html but i am not > sure how to go about doing that. If you pass your object to the template you can use the "length" filter: {{ test

Re: django admin objectaction confirmation

2016-01-18 Thread Andreas Kuhne
Hi, Check how actions work in the admin interface. You should be able to create something that works the same by clicking on a button. See here: https://docs.djangoproject.com/en/1.9/ref/contrib/admin/actions/ The main point is that if you do a http get, you should show the confirmation page, and

Re: Django Admin

2016-01-18 Thread Andreas Kuhne
Hi Rafael, I would use a plugin for django admin that creates an autocomplete field (django-selectable works). Then when the user chooses something in the autocomplete list, I would populate the other fields via ajax with the values that you need. That way you don'ẗ need a foreign key field (even

Re: Execute code which runs on the database only when the server is running - and doesn't need users to view pages.

2016-01-11 Thread Andreas Kuhne
Oh ok, Sorry I misunderstood your problem. How about running the celery task and then checking if http://localhost is up? Regards, Andréas 2016-01-11 13:31 GMT+01:00 Tony Flury : > Andreas, > > Thanks for your answer. Certainly it looks like running celery might > alleviate th

Re: Execute code which runs on the database only when the server is running - and doesn't need users to view pages.

2016-01-11 Thread Andreas Kuhne
Hi, Wouldn't it be possible to use celery and tasks for this purpose? http://www.celeryproject.org/ You could have it running all the time and have a flag in the database for when the server is running? Regards, Andréas 2016-01-11 9:59 GMT+01:00 Tony Flury : > I have a small background task (

Re: Drop down dependent on two other form fields

2016-01-04 Thread Andreas Kuhne
Hi Arindam, I didn't find any really good solution, however, googling for "django dropdown dynamic", should point you in the right direction. Hope that helps. Regards, Andréas 2016-01-05 7:07 GMT+01:00 Arindam sarkar : > Hello, > In my project I have a from in which there is three drop down.

Re: possible to setup old project (different dependencies) as a library ?

2016-01-04 Thread Andreas Kuhne
As a person who has done this on 2 separate occasions, I also think that the best way would be to start a rewrite and upgrade ASAP. However, having said that. I think you COULD be able to run the old code in a django 1.9 environment, by checking for different methods. For example in django 1.4 a m

Re: Guidelines For A Newbie

2016-01-04 Thread Andreas Kuhne
Hi Jay, What I would recommend is that you go throught the django tutorials and just "do" the js parts regardless of what they say - you will then get a bit of understanding for the django MVC concept and also how the django backend works and what goes where in django. The other issues you are ha

Re: Admin debugging delete

2015-12-18 Thread Andreas Kuhne
Hi, Are you working in django admin and using the delete checkbox to delete a child record? If so, it is not a javascript event, but it is handled by when you save to the parents form (it's a formset with child forms). I would follow where the django code stops executing. Regards, Andréas 2015

Re: update Django

2015-12-15 Thread Andreas Kuhne
Hi, As previously stated. Give us some more details and we can probably help you. I have done upgrades from 1.3 to 1.8 and 1.5 to 1.8 in different projects, we can probably help if we get some more information :-) Regards, Andréas 2015-12-15 16:55 GMT+01:00 Ovnicraft : > > > On Tue, Dec 15, 20

Re: How to search by country using django-countries?

2015-11-23 Thread Andreas Kuhne
HI Jorge, What do you mean you want to search by country? I think the easiest way would be to add a filter for the country field in admin. The thing is with the countries plugin, you only save the 2-letter version of the country (for example GB for Great Britain, ES for Spain, SE for Sweden and s

Re: Custom user model password is not hashed

2015-11-12 Thread Andreas Kuhne
etting the same result. > > On Thu, Nov 12, 2015 at 8:57 PM, Andreas Kuhne > wrote: > >> As aRkadeFR says, you seam to have mixed code there >> >> The row: >> user.set_password(self.cleaned_data["password"]) >> >> is taken from a

Re: Custom user model password is not hashed

2015-11-12 Thread Andreas Kuhne
As aRkadeFR says, you seam to have mixed code there The row: user.set_password(self.cleaned_data["password"]) is taken from a form somewhere and won't work. It should instead be : user.set_password(password) I suppose the password is going through to the create method via the kwargs argument

Re: How to get logged username in template

2015-11-12 Thread Andreas Kuhne
Hi, First of all, you are using request.user.username and not username in your template. If you want the username to be accessed via the "username" variable. You should write this in your view: def profile(request): return render_to_response('accounts/profile.html', {'username': request.user.

Re: Just starting, cannot create Password for superuser

2015-11-11 Thread Andreas Kuhne
Hi Raja, What do you mean it doesn't allow you to type anything at all? It shouldn't echo anything. The prompt doesn't move when inputing the password and that's the way it should be. Try to add a password and the press enter. You should then be prompted to re-enter the password. Without echoing a

Re: Where does the static files reside

2015-11-08 Thread Andreas Kuhne
Hi Gary, You can certainly setup a global static files location. All you need to do is add a path to STATICFILES_DIRS in your settings file. However, that is not really necessary. All files that are in a static directory in one app are accessible in other apps. You can create an app that contains

Custom Templates in Django Sitemaps Index

2015-11-06 Thread Andreas Dickow
See my new tutorial on Custom Templates in Django Sitemaps: https://biz-factory.de/django-sitemap-index-tutorial/ -- 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

Re: django admin - You don't have permission to edit anything

2015-11-06 Thread Andreas Kuhne
r models or in the User manager. Therefore, I > just copied the example from the django doc and tried running it. After > creating the superuser, I can edit the models. I have no Idea what I am > mission now. > > > On Fri, Nov 6, 2015 at 11:35 AM, Andreas Kuhne > wrote: > &

Re: django admin - You don't have permission to edit anything

2015-11-05 Thread Andreas Kuhne
Hi, You don't have permissions to edit anything, because you haven't created a superuser. The superuser in django has a property that is called "is_superuser" and should be set to True. If you don't have that property (and your createsuperuser sets some other property), you will have the same rig

Re: Django admin multipleselect filter

2015-11-04 Thread Andreas Kuhne
HI! Thanks for the pointers. I actually was able to solve it by myself. What I did was create a multichoice checkbox field in a form. Then I used a bit of javascript just to reformat the parameters in a way that I wanted then. Works very good actually. :-) Med vänliga hälsningar, Andréas Kühne S

Re: return values from static files to django admin

2015-11-02 Thread Andreas Kuhne
Hi, Yes you could just populate the dropdown list with javascript. Regards, Andréas 2015-11-02 17:27 GMT+01:00 dc : > Thanks a lot. Let me look into it. > > Is there any other way I can populate my choice list with user input? > > On Monday, November 2, 2015 at 10:19:22 AM UTC-5, Andréas Kühne

Re: return values from static files to django admin

2015-11-02 Thread Andreas Kuhne
Hi, What you are suggesting doesn't work. You can't communicate with the django backend via javascript if you don't use a lot of ajax requests. I would check django-smart-selects and see if you could use that? Regards, Andréas 2015-11-02 15:57 GMT+01:00 dc : > Any lead will be extremely helpfu

Django admin multipleselect filter

2015-11-02 Thread Andreas Kuhne
Hi all, I have a django site that displays the change list for a class called Order. The Order class has a property called status. I would like to be able to filter the change list by multiple statuses. So a user should be able to check several statuses and show all orders that have one of the che

Re: Translation is not working for Template even though po and mo files are created

2015-11-02 Thread Andreas Kuhne
Hi, I am unsure about the project level translations path, if they should be found as well. I have added them manually to settings, but only that path. Application paths get imported automatically. Regards, Andréas 2015-11-02 6:38 GMT+01:00 Sean Xu : > Sorry, > > ~/django-swingtime/django-swin

Re: Translation is not working for Template even though po and mo files are created

2015-11-01 Thread Andreas Kuhne
Hi Sean, That's interesting. You shouldn't have to add the locale paths explicitly. Good that it's wokring, but as long as you put the locale files in a directory named locale under each app and also under the project, it should just work (as long as all apps are included in the config). Just chec

Re: Django templates

2015-10-31 Thread Andreas Kuhne
Hi, There aren't any specific templates for windows or any other operating system. Django runs on a webserver and is compatible regardless of OS. I would recommend that you look at the tutorial and see how to get started: https://docs.djangoproject.com/en/1.8/intro/tutorial01/ Regards, Andréas

Re: Translation is not working for Template even though po and mo files are created

2015-10-30 Thread Andreas Kuhne
Hmmm I'm a bit at a loss here. But does Django know where to find the .mo files? Is it only your template that isn't getting translated, because you said that the form itself is? Regards, Andréas 2015-10-30 12:45 GMT+01:00 Sean Xu : > Now I have corrected the orders of each Middleware clas

Re: Translation is not working on ModelForm when widget is specified for form field

2015-10-30 Thread Andreas Kuhne
Hi, The problem is that you are redifining the fields, the fields then don't get any labels (because you haven't specified them). You can achieve what you want in two ways: Either add the following to your modelform: start_time = forms.DateTimeField(label=_("start time"), widget=SplitDateTimeWidg

Re: Translation is not working for Template even though po and mo files are created

2015-10-30 Thread Andreas Kuhne
Hi, Have you made sure that you have activated the languages you want in your application? Also, how is the current language being selected? See: https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#how-django-discovers-language-preference Regards, Andréas 2015-10-30 7:45 GMT+01:00 Se

Re: Starting a .py file from a Button in my Template

2015-10-19 Thread Andreas Kuhne
Hi, You can't do it that way. If you want to run a python file on the server, you can do it in several ways: 1. Create a view that runs all the code inside the refresh.py file. This could take an amount of time, so I wouldn't do it that way. 2. Create a view that calls a celery task to run the re

Re: Logout implementation Django

2015-10-14 Thread Andreas Kuhne
Hi, You should be able to access the website without logging in? Or do you mean that the user has access to protected pages? If you have added the login_required decorator ( https://docs.djangoproject.com/en/1.8/topics/auth/default/#the-login-required-decorator) on your view functions that should

Re: Method call at end of Django session

2015-10-03 Thread Andreas Kuhne
Hi again, What I would do is create a django management command (see https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/) and then use cron to call it a regular intervals (5-10 minute intervals for example). Another way to do it would be to use celery, which is a delayed job w

Re: Method call at end of Django session

2015-10-02 Thread Andreas Kuhne
Hi, I don't think you can reliably do that. Django never knows when the user closes his browser window. Because a session is stateless (there is only a connection to the server when it responds to a request). However you could do this via a bit of ajax or a pretty unreliable javascript event. Wha

Re: Why should we use Django Rest Framework?

2015-10-02 Thread Andreas Kuhne
Hi Robert, The main reason for using django rest framework is if you need a backend to communicate with one or more rich frontends. An example could be if you have a website running django and you want to create a mobile application for iOS or android. You can then create an API that will communic

Re: Django clustering - How to manage Image uploading

2015-09-09 Thread Andreas Kuhne
I would use something like Amazon S3 to store the images. I think that's the easiest way to do it. If you use the django-storages plugin, you can configure your servers to talk to S3 just like they were using local storage. You will never have any problems with diskspace and all of your servers wil

Re: Django - Website Bootstrap Design Breaks For Production

2015-07-17 Thread Andreas Kuhne
Hi, There is a difference to running the runserver in development and production mode. In development mode the server automatically serves all of you static files (JS and CSS). In production mode you should have a webserver in front of the uwsgi server that serves the python code. For example you

Re: Installing Django and Python 3.4 on a freshly registered Debian VPS

2015-07-04 Thread Andreas Kuhne
2015-07-04 14:19 GMT+02:00 Christian Kleineidam < christian.kleinei...@gmail.com>: > I want to install Django and Python 3.4 on a freshly registered Debian > server. > What are the steps I have to take given that I want to use Python 3.4 and > not the debian default of 2.7? > I expect I also need

Manually add image to filefield in save method on modelform

2015-06-22 Thread Andreas Kuhne
Hi all, I have created a modelform that has an Imagefield in it. I want to override the save function and manually create a filefield with an image that already exists in the file storage (S3). So the things I have to do would be: * Download the image from S3 and save it to a temporary file * Cre

Django plugin

2015-06-11 Thread Andreas Kuhne
Hi all, I was wondering if there is a plugin application for Django. What I want to accomplish is react to different kinds of events on my models and then create plugins on the fly for them. The system I am working on has for example an Order model. When a new Order is created, I want to send a n

Re: Implementing multiple user types with Django 1.7

2015-06-05 Thread Andreas Kuhne
check which kind of user it is. Regards, Andréas 2015-06-05 16:51 GMT+02:00 marcelle Kouam : > thanks for your responses > I read the tutos that you have sended me andreas but it just implement one > user. > but I want to have a structure which implements 3 types of users( handler, &g

Re: Implementing multiple user types with Django 1.7

2015-06-05 Thread Andreas Kuhne
Hi Marcelle, You should not use the user profile solution anymore, because you can now create a custom User model instead. Check for example: http://www.lasolution.be/blog/creating-custom-user-model-django-16-part-1.html This way you can add fields that are needed for your user solutions in your

Re: need to upgrade django1.4.5-->django1.5, but apt-get install django tells me i'm running latest version

2015-06-01 Thread Andreas Kuhne
2015-06-01 19:17 GMT+02:00 arthur sherman : > i get the following errors in the apache2 error.log: > > VersionConflict: (Django 1.4.5 (/usr/lib/python2.7/dist-packages), > Requirement.parse('Django>=1.5')) > > but when i attempt upgradinging django apt-get install reports that i'm at > the latest

Re: "&" string to template adds "&" in the html

2015-05-21 Thread Andreas Kuhne
2015-05-21 18:35 GMT+02:00 dk : > I am creating a string inside the view that will be use in the template on > the javascript. > my string in python contains & and I print the view and works fine, but > when is send to the template I don get &. > > is there something magical about & ? or any

Re: Invalid HTTP_HOST, can someone explain why I am getting this?

2015-05-15 Thread Andreas Kuhne
You are getting it because someone has come to your server by entering www.g3suprimentos.com.br in a browser. If you don't have that address in the allowed hosts setting, you will get the error you have received. If you don't want your server to show something for www.g3suprimentos.com.br, then th

Re: Version

2015-04-21 Thread Andreas Kuhne
Hi, First of all, don't use apt-get to install django, you will never get the version you want. Use a virtualenv instead: Google virtualenv install ubuntu (and your ubuntu version). Create a virtualenvironment and install django with pip. Using pip you can install whatever version of django you wa

Re: csrf_exempt decorator and class based views

2015-04-15 Thread Andreas Kuhne
First of all, why are you not using the default views that django provides? In your case all you have to do is subclass the View class (django.views.generic.View) to get all the functionality that you require (i.e. you get a post and get method that will automatically be called). Second of all, ch

Re: image handling

2015-03-25 Thread Andreas Kuhne
d.Will it be called automatically when i edit image. > > I have used upload function to call a function which change the name of > the image and save it to the database. > > On Wed, Mar 25, 2015 at 1:44 PM, Andreas Kuhne > wrote: > >> Hi, >> >> No, that is n

Re: image handling

2015-03-25 Thread Andreas Kuhne
= >> "Pincode",max_length=20,blank=True) >> country=models.CharField(verbose_name = >> "Country",max_length=30,blank=True) >> comment=models.CharField(verbose_name = >> "Comment",max_length=200,blank=True) >> sex=models.Cha

Re: Image resizing

2015-03-25 Thread Andreas Kuhne
imageresize = image.resize((100,100), > Image.ANTIALIAS) * > *imageresize.save( 'JPEG', quality=75)* > *regform.save();* > return HttpResponseRedirect('/index/') > else: >

Re: image handling

2015-03-24 Thread Andreas Kuhne
,max_length=30,blank=True) > comment=models.CharField(verbose_name = > "Comment",max_length=200,blank=True) > sex=models.CharField(verbose_name = "Sex *",max_length=5,blank=False) > image=models.FileField(verbose_name = "Image(limit 1Mb) > *&quo

Re: image handling

2015-03-24 Thread Andreas Kuhne
ou please tell me how to use above mentioned function in > edit_profile function in view, Can i call another function from another > function in views.py, if yes please tell me > > On Tue, Mar 24, 2015 at 6:11 PM, Andreas Kuhne > wrote: > >> Hi, >> >> Ok, so wha

Re: Image resizing

2015-03-24 Thread Andreas Kuhne
e, Mar 24, 2015 at 6:13 PM, Andreas Kuhne > wrote: > >> Hi, >> >> Check out the easy_thumbnails plugin. >> http://easy-thumbnails.readthedocs.org/en/2.1/ >> >> It automatically resizes all images to the size you want if you use it >> correctly. >

Re: Re-run only tests that failed last time

2015-03-24 Thread Andreas Kuhne
If you have created packages for your tests, you can run all tests in a package. If the tests aren't in the same package, it won't help you however. Regards, Andréas 2015-03-24 11:27 GMT+01:00 Gergely Polonkai : > Hello, > > I have a pretty extended test suite for my application, which can run

  1   2   3   4   5   6   >