Design question: Is it really a good idea for models having “side effects”?

2015-02-20 Thread Gergely Polonkai
Hello, I’m currently implementing a finite state machine in my application using Django FSM[1]. In the Usage section of the README the author said that “This function may contain side-effects, like updating caches, notifying users, etc.” Opposing this statement, the Symfony PHP framework’s aut

Django and pydoc - ImproperlyConfigured

2015-02-24 Thread Gergely Polonkai
Hello, I'm trying to document my own webpage's code so I will remember each piece if I have to touch it later. I added docstrings to several functions already, and while this is generally enough, I couldn't help but tried pydoc blog.models.Post What I got instead of the craved documents was an Im

Re: Migrations force me to have, forever, any name/reference I use in field validators=, choices=, whatever, valid forever (even if the requirements change).

2015-02-27 Thread Gergely Polonkai
Hello, another solution may be to patch your models in the migration module or class, like: import myapp.models myapp.models.valid_identifier = something_acceptable() Although it seems a bit ugly, I just tested it, and it works. This way valid_identifier will live during the migration only. Be

Re: How to get/assign the contents of the app code directory into my Django project

2015-03-10 Thread Gergely Polonkai
Hello, this pretty much depends on your environment. I, personally, use virtualenv and pip, so most likely will install such an external app like this: pip install git://my.favourite.provider/awesome/app.git If you use your system python, with a system-wide installed django, then you may either

Re: How to get/assign the contents of the app code directory into my Django project

2015-03-10 Thread Gergely Polonkai
ed app. > I mean, after downloading the app via git clone... should I create/edit > some configuration file to get the contents of the "src/idea" app directory > into my django project? and how? :-( > > Thanks again! > > > On Tuesday, March 10, 2015 at 4:03:55 PM UTC-6, Gergely

Re: Generic Relation in Legacy Database?

2015-03-11 Thread Gergely Polonkai
> > On Mar 10, 2015, at 3:30 PM, Gergely Polonkai wrote: > > Hello, > > By taking a quick glance on I'm afraid that a GFK subclass is your best > bet. I was experimenting with a Doctrine DB (based on your description my > guess was that your old ORM may be that).

Re: Generic Relation in Legacy Database?

2015-03-12 Thread Gergely Polonkai
Hello, By taking a quick glance on I'm afraid that a GFK subclass is your best bet. I was experimenting with a Doctrine DB (based on your description my guess was that your old ORM may be that). A little bit of change to GFK made the query working, although I haven't solved the insert/update probl

Testing template context processors

2015-03-17 Thread Gergely Polonkai
Hello, I wrote a context processor which makes some global variables of mine available for templates. I cannot find a good (cough… any) article on how to test such processors. Could you give me some directions on where to start with writing one? Thanks in advance! Best, Gergely -- You received

Re: Testing template context processors

2015-03-17 Thread Gergely Polonkai
] for middleware testing, funny that I didn't think of this way (especially as I implemented it today), so thanks for pointing out! [2] https://pypi.python.org/pypi/mock On 17 Mar 2015 17:59, "Carl Meyer" wrote: > Hi Gergely, > > On 03/17/2015 10:52 AM, Gergely Polonkai

Testing migrations

2015-03-20 Thread Gergely Polonkai
Hello, I just wrote a migration class with RunPython. When I run my tests, my coverage value drops to to ninety-something percents, because the initial database created by the test runner is (obviously) empty, thus, my migration function’s for iteration won’t run. Is there a way to test such migr

Re-run only tests that failed last time

2015-03-24 Thread Gergely Polonkai
Hello, I have a pretty extended test suite for my application, which can run for about 15 minutes. Now when I introduce an error, I will be notified of it pretty late, and a one-liner fix needs another 15 minutes to check. Of course if only one of my tests fail, I can add the name of the test case

Re: Re-run only tests that failed last time

2015-03-24 Thread Gergely Polonkai
link! On 24 March 2015 at 15:08, Ramiro Morales wrote: > On Tue, Mar 24, 2015 at 7:27 AM, Gergely Polonkai > wrote: > > Hello, > > > > I have a pretty extended test suite for my application, which can run for > > about 15 minutes. Now when I introduce an error, I wil

Re: Re-run only tests that failed last time

2015-03-24 Thread Gergely Polonkai
suite GUI tool, like cricket: > > http://pybee.org/cricket > > Cricket lets you view your entire test suite as a tree, select subsets of > the suite to run, see test results as the suite executes, and re-run the > failures from the previous execution. > > Yours, > Russ

Re: Re-run only tests that failed last time

2015-03-25 Thread Gergely Polonkai
Hello Carl, thanks, I will take a look at this, too! Best, Gergely On 24 March 2015 at 23:33, Carl Meyer wrote: > Hi Gergely, > > On 03/24/2015 04:27 AM, Gergely Polonkai wrote: > > I have a pretty extended test suite for my application, which can run > > for about 1

Re: Django accepting other applications ports

2015-03-25 Thread Gergely Polonkai
Hello, Please share the rest of this Apache config; from what you copied, it's impossible to tell. Best, Gergely On 25 Mar 2015 17:12, "Sven Mäurer" wrote: > I have two applications on my apache. Why is my Django application running > accepting the connection also of port ? > > Listen 8787

Inserting literal % sign in QuerySet.extra()

2015-03-27 Thread Gergely Polonkai
Hello, I’d like to execute the following code: Booking.objects.filter(start_ts__isnull = False, end_ts__isnull = False).extra(select = {'amount': "strftime('%s', end_ts) - strftime('%s', start_ts)"}) However, in the shell, I get the following error: Traceback (most recent call last): File "", l

Re: Inserting literal % sign in QuerySet.extra()

2015-03-27 Thread Gergely Polonkai
t; > On Friday, March 27, 2015 at 5:38:15 PM UTC-4, Gergely Polonkai wrote: >> >> Hello, >> >> I’d like to execute the following code: >> >> Booking.objects.filter(start_ts__isnull = False, end_ts__isnull = >> False).extra(select = {'amount':

Re: Django TCP Socket Communication

2015-03-28 Thread Gergely Polonkai
Hello, it's a bit hard to understand what you exactly want to achieve. How can you communicate with the microcontroller? Do you connect to one of its TCP ports, and send it data, I assume. Is it done with a well-known protocol, like HTTP, or some custom one? You say that it opens a port every 5 s

Re: Strange deployment problem

2015-03-28 Thread Gergely Polonkai
Hello, do you have command line access on that machine? If so, can you connect to the database using the credentials in the settings file? Best, Gergely On 28 Mar 2015 14:21, "Anderson Resende" wrote: > > I don't used mysql,but in postgres for you write in a database your user > db needs permis

Re: GUI with web-browser using Django, Python 3

2015-05-04 Thread Gergely Polonkai
Hello, you should walk through the Django tutorial[1] to get as idea on how to use it. However, if this is the sole problem, I think Django is overkill, a pure WSGI page would suffice. Best, Gergely [1] https://docs.djangoproject.com/en/1.8/intro/tutorial01/ On 4 May 2015 17:28, "Aura" wrote:

Re: Generic template; determining information about calling view/app

2015-05-10 Thread Gergely Polonkai
Hello, I wrote a middleware[1] for my old blog engine; here, view_func.__module__ is the app’s name. It is not really sophisticated, though, but it may provide a good start. About the URL namespace, I don’t think it’s easy to do. An app doesn’t have a namespace; you can include an url definition

Re: Interaction of Python Code with Django.

2015-05-12 Thread Gergely Polonkai
The tricky part here is providing the input for the interactive tool. For shell scripts there is a software called expect, you may want to look for Python alternatives. Of course, if this interactive tool reads sequential input from stdin and sends output to stdout, there are much easier solutions,

Re: How to load an object created from a model outside the project ?

2015-05-13 Thread Gergely Polonkai
Hello, if you don't have to modify the object, I would suggest using serialization instead of pickling. Best, Gergely On 13 May 2015 16:01, "Matthieu" wrote: > Hi, > > I saved with pickle an object created from a Django model : > > class Country(models.Model): > code = models.IntegerField(p

Re: Global Variable Neded? - Python 2.7.8 / Django 1.7

2015-05-13 Thread Gergely Polonkai
Hello, I think the source of your frustration is that you started on the wrong track. If you create a global variable here, *all* your users will see the same fields. I guess it’s not really the thing you want. You have several other options here: 1) Add a user setting in the database If you cr

Re: How to load an object created from a model outside the project ?

2015-05-14 Thread Gergely Polonkai
Hello, depends on what exactly you want to do. You can take a look at Django’s own serialization solution[1], or, if you want to build a REST framework based on this, you may want to look at [2] or [3]. Best, Gergely [1] https://docs.djangoproject.com/en/1.8/topics/serialization/ [2] https://dja

Re: Logout user on tab closing

2015-05-19 Thread Gergely Polonkai
Well, onunload can be used if you are creating a one-page app, e.g. by using AngularJS. With multipage apps, this is of no use. On 19 May 2015 16:54, "Javier Guerra Giraldez" wrote: > On Tue, May 19, 2015 at 8:23 AM, Miloš Milovanović > wrote: > > I want to logout a user from application when th

Re: How to get a application-formpost in django view? Get QueryDict variables.

2015-05-21 Thread Gergely Polonkai
Assuming your QueryDict is called my_post_data, use my_post_data.get('data[id]'). On 21 May 2015 15:28, "Fellipe Henrique" wrote: > Hello, > > I need to get one application-form-post content from one server. This > server isn't mine. > > They send to me this application-form-post, and in Django V

Re: How to get a application-formpost in django view? Get QueryDict variables.

2015-05-21 Thread Gergely Polonkai
6B16A163'], 'data[status]': >>> ['paid'], 'event': ['invoice.status_changed'] >>> >>> as the "key"... >>> >>> :( >>> >>> T.·.F.·.A.·. S+F >>> *Fellipe Henrique P. Soares*

Re: Migrating from sqllite3 to postgres

2015-05-22 Thread Gergely Polonkai
I will also have to do this in the near future (same reason), and already have some untested ideas. My guess is to add a second database in settings.DATABASES, fetch all the model instances from my original db and save them in the other. But if anyone has a better solution, let us know! On 22 May 2

Re: Address book using django

2015-05-22 Thread Gergely Polonkai
Hello, besides that it sounds like a homework to me, I don't see why you need an admin module, as Django already has one. For everything else, if you walk through the tutorial app, you should get most of the ideas from there. Best, Gergely On 22 May 2015 09:19, "Preeti" wrote: > I have to crea

Re: How to get a application-formpost in django view? Get QueryDict variables.

2015-05-22 Thread Gergely Polonkai
lkrrovknFmsgor4ius" | perl -pe \ > 's/(.)/chr(ord($1)-2*3)/ge' > *Blog: http://fhbash.wordpress.com/ <http://fhbash.wordpress.com/>* > *GitHub: https://github.com/fellipeh <https://github.com/fellipeh>* > *Twitter: @fh_bash* > > On Fri, May 22, 2015

Re: Address book using django

2015-05-22 Thread Gergely Polonkai
You say that your backend is ready. Does this mean you have created your models and can access them from the shell (pythen manage.py shell, see the first chapter of the tutorial, section Playing with the API)? If so, what parts of the frontend creation you don't understand? Is it view creation or

Re: Address book using django

2015-05-23 Thread Gergely Polonkai
The error message is somewhat clear on this: there is no such module as django.contrib.staticfilesdjango. The django at the end seems to be the cause to me. On 23 May 2015 20:19, "Preeti" wrote: > this is the error I find.. [kindly check the attachment] > > -- > You received this message because

Changing a form field's value during cleaning

2015-05-26 Thread Gergely Polonkai
Hello, I'm currently having hard times changing a form field's value from within the form's clean() method. I have already tried setting self.initial[field_id] and manipulating the cleaned data by calling super's clean method, change the required field (cleaned_data[field_id]) and returning the mo

Re: Changing a form field's value during cleaning

2015-05-26 Thread Gergely Polonkai
ds in the first > place? > > On Tue, May 26, 2015 at 9:55 PM, Gergely Polonkai > wrote: > >> Hello, >> >> I'm currently having hard times changing a form field's value from within >> the form's clean() method. I have already tried setting &g

Re: Changing a form field's value during cleaning

2015-05-27 Thread Gergely Polonkai
OST data.>>> f = AuthorForm(request.POST) > # Create, but don't save the new author instance.>>> new_author = > f.save(commit=False) > # Modify the author in some way.>>> new_author.some_field = 'some_value' > # Save the new instance.>>> new_

Re: Changing a form field's value during cleaning

2015-05-27 Thread Gergely Polonkai
y work. > > Redirecting back to a clean version of the form with an error message is > probably easiest, and can serve as a stop gap until you figure out the more > desirable behavior. > > -James > On May 27, 2015 12:47 AM, "Gergely Polonkai" wrote: > >> Hello, &g

Re: Django Test Coverage

2015-05-28 Thread Gergely Polonkai
Hello, IMHO it is much better to see the coverage values for everything (even tests.py). Your actual case, for example, shows that only 98 lines are running from your 100 lines long tests.py. This may mean that there is a condition somewhere in your test cases that never evaluates to true. If you

Re: CSRF verification failed when I use smart phone

2015-05-31 Thread Gergely Polonkai
I had this error when I had two Django application with the same domain and both with the same (default) CSRF cookie name. Changing the cookie name to something different solved the issue. On 30 May 2015 22:30, "Michael Greer" wrote: > We have started seeing this behavior occasionally. No code ch

Re: why i failed to install django?

2015-06-02 Thread Gergely Polonkai
This doesn’t seem to be a Django issue to me… Can you install any other packages with pip? 2015-06-02 20:12 GMT+02:00 mnz hz : > > > IOError: [Errno 22] invalid mode ('wb') > > > detailed error message is as follows: > > > http://pastie.org/10219723#1,21 > > -- > You received this message becaus

Re: how to get get-pip.py

2015-06-05 Thread Gergely Polonkai
Hello, it seems that the user running pip doesn’t have write access to the temp directory. You should check the permissions of C:\Users\SteveB\AppData\Local\Temp and its subdirectories as you can see in the PermissionError line (just change the double backslashes (\\) to single ones (\). Is it po

Re: how to get get-pip.py

2015-06-05 Thread Gergely Polonkai
x27;t know about windows installation. >> >> On Fri, Jun 5, 2015 at 10:20 PM, Gergely Polonkai >> wrote: >> >>> Hello, >>> >>> it seems that the user running pip doesn’t have write access to the temp >>> directory. You should check the permi

Re: how to get get-pip.py

2015-06-05 Thread Gergely Polonkai
h I thought tha t I told you thsat I *was *able to make python/pip work! > It's just this little thing about not being able to upgrade pip which > bothers me, just a little bit. and I am not trying to run pip with any > other User other than myself. > > On Fri, Jun 5, 2015 at 1:

Re: Command line script > Ensure that its module, "models", is located inside an installed app. error

2015-06-07 Thread Gergely Polonkai
Hello, you should remove the sys.path.append() line, and use from .models import MyichiTickers. Also, it seems that you are writing a custom python script instead of implementing it in your project. If I were you, I would create a django-admin command, so it would work like python manage.py hist

Re: Command line script > Ensure that its module, "models", is located inside an installed app. error

2015-06-07 Thread Gergely Polonkai
Hello, Sorry, I forgot that relative imports don’t work in standalone scripts, just modules. In this case, yes, you should go on with the original import line of yours, and modify the loading path. However, if you want to use your models outside of Django, that is 1) pretty much unsupported and 2)

Re: Command line script > Ensure that its module, "models", is located inside an installed app. error

2015-06-08 Thread Gergely Polonkai
Hello, This SO answer[1] will provide you with decent answer on what this *args and **kwargs things are. Hope that helps! Best, Gergely [1] http://stackoverflow.com/a/3394898 2015-06-08 15:03 GMT+02:00 felix : > El 08/06/15 08:23, Oscar Buijten escribió: > > Just to let you know that I got t

Simulating REMOTE_USER login with the test server

2015-06-09 Thread Gergely Polonkai
Hello, I’m about to use the test server with REMOTE_USER based logins. I already know how to set it up with my Apache based server, but I can see no way of doing the same with the dev server (manage.py runserver). I have tried setting the environment variable REMOTE_USER to a desired value, as I s

Re: Simulating REMOTE_USER login with the test server

2015-06-10 Thread Gergely Polonkai
That’s exactly what I was doing, just haven’t had the time yet to share my experience :) 2015-06-10 11:55 GMT+02:00 'Tom Evans' via Django users < django-users@googlegroups.com>: > On Tue, Jun 9, 2015 at 10:07 PM, Gergely Polonkai > wrote: > > Hello, > > &g

Test cases fail with authentication against REMOTE_USER with normal auth fallback

2015-06-10 Thread Gergely Polonkai
Hello, I was trying to follow https://docs.djangoproject.com/en/1.8/howto/auth-remote-user/. If I enable django.contrib.auth.middleware.RemoteUserMiddleware, even if I set AUTHENTICATION_BACKEND to contain both RemoteUserBackend and ModelBackend, my test cases stop working. However, using the run

Re: Multiple User Roles design

2015-06-13 Thread Gergely Polonkai
Hello, if you create groups, you don’t have to create different models for different roles (well, unless you have different data to store for Students and Instructors). Just connect the correct User object with the correct Group. Another method is to use the Permission handling system of Django,

Re: How to permissions to a group in Django 1.8?

2015-06-13 Thread Gergely Polonkai
Hello, as the first step, you may want to look at [1]. Also, there is django-guardian[2], which may be a bit more appropriate for your situation. Best, Gergely [1] https://docs.djangoproject.com/en/1.8/topics/auth/default/#topic-authorization [2] https://django-guardian.readthedocs.org/en/v1.2/

Re: Running DJango with uWSGI with a user that has sudo access?

2015-06-14 Thread Gergely Polonkai
Hello, the problem of the root access usually comes into play when your site gets hacked (or if you don't trust the framework written by someone else, which is not always a bad idea). Up until then, you can safely run your application under root privileges. When your site gets hacked, the main go

ValueError during migrations.RunPython to create OneToOne records in new model

2015-06-17 Thread Gergely Polonkai
Hello, I have created a new model called Settings, which has a OneToOneField(User, primary_key=True) field. After the automatically created migrations.CreateModel() invocation I added a RunPython line that runs this function: def create_user_settings(apps, schema_editor): User = get_user_mode

Re: ValueError during migrations.RunPython to create OneToOne records in new model

2015-06-17 Thread Gergely Polonkai
get_model() instead of get_user_model(). See > https://docs.djangoproject.com/en/1.8/topics/migrations/#data-migrations > > /Markus > > On June 17, 2015 12:48:48 PM GMT+02:00, Gergely Polonkai < > gerg...@polonkai.eu> wrote: > >Hello, > > > >I ha

Re: Atomic block termination question

2015-06-24 Thread Gergely Polonkai
As for me I have a function registered for the post_save signal, so after saving the 1:1 object gets created. If you don't mind that the 1:1 object gets created outside of the atomic block, it should work for you, too. On 24 Jun 2015 10:16, "Mike Dewhirst" wrote: > On 24/06/2015 4:43 PM, Mike Dew

Re: how to deploy django 1.8 + python 3.3 on Openshift

2015-06-25 Thread Gergely Polonkai
http://lmgtfy.com/?q=openshift+django+python+3.3 (I didn't put this in the subject to keep the thread intact. Please learn to ask before you do so) On 25 Jun 2015 06:23, "Arindam sarkar" wrote: > > > -- > Regards, > > Arindam > > Contact no. 08732822385 > > > -- > You received this message beca

Re: django unique email id model

2015-06-27 Thread Gergely Polonkai
Hello, this depends on a load of things. Which version of Django do you use? Do you have a custom user model, or you use the built in one? Best, Gergely On 27 Jun 2015 13:47, "Arindam sarkar" wrote: > i am just starting with django. I need create a site with signup/sign in . > i want user to si

Re: Can't Start Project.

2015-07-01 Thread Gergely Polonkai
No, Django does that for you. You only have to worry about DB settings if you want something else like MySQL or Postgres. On 1 Jul 2015 23:40, "Bill Freeman" wrote: > Yes. syncdb should work, assuming that sqlite is available (I think that > it's built in in all the python 3.x versions), and ass

Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

2015-07-16 Thread Gergely Polonkai
You don't need the temporary field. 1) create the "through" model, add it to the migration file 2) migrate all m2m instances (e.g. iterate over all Bereich objects then iterate through its users, creating a UserBereichAssignment object for each (all this done in a migrations.RunPython call) 3) cha

Re: Interfacing Django Project with Python Script

2015-07-17 Thread Gergely Polonkai
I think what you really need is a custom Django management command. You can take a look at the implementation of createsuperuser, it takes some input and creates a user based on this info. On 17 Jul 2015 18:55, "Jake Rudolph" wrote: > So basically I have my Django app that takes in information fr

Re: Good practise on Form logic

2015-07-18 Thread Gergely Polonkai
Hello, whichever fits you. If you always and only do it before saving, you can integrate it in the form's save() method, for example. Another thing to consider is, what does some_logic do? If it works only with the form data (e.g. transposing it somehow, which new data may be used by others like

Re: SHOP APP

2015-07-21 Thread Gergely Polonkai
…anyways, I'm not really sure it can be done in mere 6 hours. Or if so, I wouldn't dare to deploy it to production :) On 22 Jul 2015 00:06, "Cesar Mojarro" wrote: > hahaha! > Can you do my homework? > > On Tue, Jul 21, 2015 at 4:59 PM, Russell Keith-Magee < > russ...@keith-magee.com> wrote: > >>

Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

2015-07-23 Thread Gergely Polonkai
Hello, I'm sorry, I was not around my mailbox lately. Yes, you are right, my attempt is not the solution to your problem; it seems that this m2m field really cannot be modified like this. With some slight modifications, though, it may be. 1) create the through table 2) migrate data with RunPytho

Re: Django : DRF Token based Authentication VS JSON Web Token

2015-07-23 Thread Gergely Polonkai
Hello, after a quick read I cannot find any essential differences between the two, in regards of authentication. JWT, however, is much more fine grained and has a bunch of token manipulation options. Best, Gergely On 24 Jul 2015 03:01, "Ankit Agrawal" wrote: > >Hi everyone, > > > I am b

Re: Model opinnions

2015-07-25 Thread Gergely Polonkai
MEDIA_URL is a prefix that you will put in front of the URL media files. E.g. you set your webserver to load such files under the /media/ URL, like www.example.com/media/my-video.webm. Using different storage backends, like an Amazon S3 bucket, you may want to set this to the bucket's URL. However

Re: Model opinnions

2015-07-25 Thread Gergely Polonkai
Do you save your avatar images there? Do you prepend MEDIA_URL to the avatar's src=""? How do you display the image by the way? These are the quick questions that came into my mind without knowing your setup… On 25 Jul 2015 22:59, wrote: > Nah, I just want to have an avatar inside, to get easy.

Re: Model opinnions

2015-07-26 Thread Gergely Polonkai
tter image in a new tab. > > About the setup... > MEDIA_ROOT = os.path.join(BASE_DIR, '/media/') > MEDIA_URL = '/media/' > So *localhost:8000/media/images/avatar.jpg* would work, isn't it? > > > El sábado, 25 de julio de 2015, 23:14:58 (UTC+2), Gergely

Re: Using django login functionality in a non django app

2016-04-25 Thread Gergely Polonkai
Hello, this all depends on how this Qt app communicates with the other end (server side). Does it offer *any* kind of authentication/authorization? If so, look for ways to integrate it with Django. If not, you are screwed anyway (from security point of view), because even if your app pops up a log

Re: Using django login functionality in a non django app

2016-04-25 Thread Gergely Polonkai
e @login_required, and if that is called and the user is not > logged in, it would invoke the django login page - just like it works > in django. I think I can do most of this, the part I am unclear on is > how I get control from the django login page back to the Qt app. > >

Re: Using django login functionality in a non django app

2016-04-26 Thread Gergely Polonkai
That’s not a big issue if you really communicate with Django via a web-based API. If the user can’t log in, you can simply redirect them to a web page. I don’t see the need for user admin functions, though. Gergely Polonkai [image: https://]about.me/gergely.polonkai <https://about

Re: Using django login functionality in a non django app

2016-04-26 Thread Gergely Polonkai
That means you have to be able to do it via the API. The other solution is to pop up a web view for these tasks. However, we are moving out from Django field here, as this is getting more and more a falcon/UX-related question. Gergely Polonkai [image: https://]about.me/gergely.polonkai <ht

Re: Using django login functionality in a non django app

2016-04-27 Thread Gergely Polonkai
I would create a separate view for this, like /falcon_login/, which could give you a plain text result. But that’s totally up to you. Gergely Polonkai [image: https://]about.me/gergely.polonkai <https://about.me/gergely.polonkai?promo=email_sig&utm_source=email_sig&utm_mediu

Re: Completed form for an authenticated user

2016-04-27 Thread Gergely Polonkai
entered Is this it? Also, have you gone through the tutorial? If not, I strongly suggest to to so. It will clear a lot of things both about Django and the web in general. Best, Gergely Gergely Polonkai [image: https://]about.me/gergely.polonkai <https://about.me/gergely.polonkai?promo=email_

Re: Nagios plugins for Monitoring Django Apps

2016-04-27 Thread Gergely Polonkai
Hello, I don’t know of any built-in metrics in Django that you can monitor. If you write some for your apps, you could also write some monitoring scripts, too (probably in the form of a management command). Best, Gergely Gergely Polonkai [image: https://]about.me/gergely.polonkai <ht

Re: What is completed listing all formaters (fakers, providers) in FactoryBoy?

2016-04-30 Thread Gergely Polonkai
Looking at FactoryBoy’s documentation, it doesn’t seem you can use these; for example, slug is never mentioned in the documentation. What exactly do you want to achieve? Are you sure it’s FactoryBoy you are looking for? Gergely Polonkai [image: https://]about.me/gergely.polonkai <ht

Re: Help Replicating a Django App Repo

2016-05-08 Thread Gergely Polonkai
Hello, 1. Clone the repo (success) 2. Install pip requirements (mention using virtualenv, but don't make it a requirement; pip install -r requirements.txt in a venv succeeded) 3. Set the SECRET_KEY environment variable (I think you shouldn't make creating secret.sh a requirement, just suggest it;

Re: ubuntu+nginx+django urlpatterns 404 not found

2016-05-08 Thread Gergely Polonkai
What do you mean it doesn't work? What error message you get? Are you sure it is provided by Django and not the webserver? Also, GMail is marking your message as a possible malware; consider pasting your urls.py inline instead of an attachment. On May 8, 2016 15:39, "minom du" wrote: > Hello ,ev

Re: ubuntu+nginx+django urlpatterns 404 not found

2016-05-09 Thread Gergely Polonkai
oard_list=board.objects.using("default").all() > return render_to_response('index.html',locals()) > > just same of notice > it still return 404 not found > > the environment is ubuntu+nginx+django 1.8.13 > > > and i try build it on the environment w

Re: ubuntu+nginx+django urlpatterns 404 not found

2016-05-10 Thread Gergely Polonkai
If your 404 pages are white with DEBUG=True, then the problem lies within the web server config. Could you show us the working apache config, too? i tried and still return 404 not found Sai K於 2016年5月10日星期二 UTC+8下午7時36分57秒寫道: > > Can you change the url for board some thing like : *url(r'^board$',

Re: Best way to switch from mysql to postgres?

2016-05-11 Thread Gergely Polonkai
Hello, this depends on a lot of factors, like the anatomy of your models and signals. I have a model which is is not administered, but every time I create a user, a new row is added by a signal. This way, loading such a dump is impossible without some modifications to these signals. All in all, i

Re: Delete all migration files

2016-05-12 Thread Gergely Polonkai
Hello, Michal is right, except… If you have only one server running your code, there is no real need to keep your unsquashed migrations; do a squash, and remove everything else. If, however, your app's source is public, imagine the following scenario: You publish your app with 3 migration files

Re: get all columns as a list

2016-05-19 Thread Gergely Polonkai
Hello, Django can’t do this out of the box, but see this post[1] for a possible solution with dicts. You might also want to look at serialization[2]; it might help you a bit, but again, it’s primarily for dicts, not lists. On the other hand, I started wondering why you need this, do you care to

Re: is there any django app for opendata

2016-05-20 Thread Gergely Polonkai
, Gergely Gergely Polonkai [image: https://]about.me/gergely.polonkai <https://about.me/gergely.polonkai?promo=email_sig&utm_source=email_sig&utm_medium=email_sig&utm_campaign=external_links> 2016-05-20 0:59 GMT+02:00 Luis Zárate : > Hi, > > I interested in opendata and open

Re: Complicated relationships

2016-05-23 Thread Gergely Polonkai
I would make Restaurant.dishes a @property that returns all dishes the restaurant's chefs can make: return Dish.objects.filter(chef__restaurant=self) On May 23, 2016 14:46, "Jani Tiainen" wrote: > Something like > > Chef: > # Nothing special here, reverse relations will be done automatical

Re: UserProfile Pattern (extending User model); Migrations; New fields/columns on models.

2016-05-23 Thread Gergely Polonkai
Hello, did you run manage.py migrate? When you add a ForeignKey or OneToOne to a model, what actually gets stored in the DB is the ID of the referenced object (in this case, a auth.models.User). So the user_id column should be created for you during the next makemigrations+migrate combo. On a si

Re: I am not able to run the following code

2016-05-26 Thread Gergely Polonkai
I don’t see any error here; what is the error message you see? Gergely Polonkai [image: https://]about.me/gergely.polonkai <https://about.me/gergely.polonkai?promo=email_sig&utm_source=email_sig&utm_medium=email_sig&utm_campaign=external_links> 2016-05-26 10:16 GMT+02:0

Re: Questions about Deploying django for production using apache and mod_wsgi.

2016-05-26 Thread Gergely Polonkai
On May 26, 2016 20:12, "Bruce Whealton" wrote: > > Hello all, > I have a few questions of which I am not finding answers. > 1) If I export my development db (Postgresql) and then import it into production database, > won't I be pulling in a very weak password that I used for development? I

Re: how to use view function in another function of view in django

2016-06-15 Thread Gergely Polonkai
Just like this. Unless you have a specific use case you forgot to share in your mail. Views are mere functions that get called with a request az a parameter. You shouldn’t treat them as special/holy/uncallable. Best, Gergely On Jun 15, 2016 19:56, "hossein" wrote: > def base(request): > j=J

Re: Using the Eclipse mysite>django>custom command(manage.py$(custom_command)) function

2016-06-26 Thread Gergely Polonkai
Hello, that message tells you everything. As there is no tty (ie. a terminal that can read user input and write some output), createsuperuser won’t run. I don’t know eclipse, but if you can force it to run commands within a tty, you won. Otherwise you will have to use the command line. Well, exc

Re: When need return the HttpResponseBadRequest and why?

2016-07-04 Thread Gergely Polonkai
400 Bad Request is responded if the client sends a… um… Bad Request? Jokes aside, it may represent many things. Web servers may send 400 if the HTTP request is malformed. Applications, such as a Django app, may send 400 if the request cannot be processed, e.g. when a required header is missing or

Re: TypeError: $.get is not a function

2016-07-25 Thread Gergely Polonkai
This sounds to be a JavaScript problem, which is not part of Django in any ways. My idea, however, is that you don’t import another JS file that contains the $ function (probably jQuery or Prototype?) Gergely Polonkai [image: https://]about.me/gergely.polonkai <https://about

Re: Migrations for forms fields

2016-08-16 Thread Gergely Polonkai
Hello, rename migrations in your head to database migrations, or even model to database migrations. The migration process takes all your models and applies all the changes in them to your database (usually an SQL instance in the wild). Forms, on the other hand, are just that: forms, that can get

Re: Unable to get tests to work

2016-08-17 Thread Gergely Polonkai
Hello, this “refreshes.backups.tests” thing bothers me a lot. Could you show us your directory structure, please? Best, Gergely On Wed, Aug 17, 2016, 23:03 Matt wrote: > Ok a step forward. When I spell out the tests it works: > > https://dpaste.de/2MXf > > But when I run test without arguments

Re: Using version control with django

2016-08-23 Thread Gergely Polonkai
Hello, the fact you develop alone doesn't make SVN a better choice than Git, Mercurial, or any other distributed version control. But as you already made your choice, here are my two cents. You should put all the stuff under trunk/, so it becomes trunk/manage.py, trunk/crm/, etc. If you are devel

Strange failing test

2016-08-24 Thread Gergely Polonkai
Hello, I have a test that fetches some JSON data from my API and compares it with the expected result, which is generated like this: expected_json = { 'status': 'ok', 'invalid-fields': {}, 'updated-fields': cloned_build.groupings.get(group=group1)

Re: Strange failing test

2016-08-24 Thread Gergely Polonkai
updated-fields': [2,3] > } > > assert cmp(expected_json, actual_json) == 0 # same > assert cmp(expected_json, invalid_json) == -1 # different > > Hope this helps. For more background & discussion, see: > > > http://stackoverflow.com/questions/452794

Re: Strange failing test

2016-08-24 Thread Gergely Polonkai
be glad to know that's fixed in Django 1.10: > https://github.com/django/django/commit/e0837f2cb12de5e95e621d19b186b0da43bcdee2 > > > On Wednesday, August 24, 2016 at 10:27:37 AM UTC-4, Gergely Polonkai wrote: > >> It just turned out that value_list(…, flat=True) ret

Re: ti possible CommaSeparatedIpField

2016-08-31 Thread Gergely Polonkai
Hello, although it is possible, I'd go with an IP field and generate a list of them, comma separated, at run time. This will make it easier to search and manage the list. Best, Gergely On Wed, Aug 31, 2016, 00:29 Jorge Cadena wrote: > Hi > > I have a idea CommaSeparatedIpField, it possible ?

Re: I am searching: How to make drop down list in django

2016-09-01 Thread Gergely Polonkai
This very much depends on what exactly want to do, but in general, it doesn’t really Django’s job. Can you produce the desired result in a plain HTML file? If not, you should visit an HTML/CSS tutorial; if yes, you should define your problem a bit better, otherwise we won’t be able to help you. e

Re: Django migrate generates SQLite3 file filled with junk

2016-09-25 Thread Gergely Polonkai
That file is an SQLite database, which is a binary format. It should look like this. I know it is confusing, because of that bunch of SMS statements, but it's OK that way. If you want to interact with it, use the sqlite3 command, or an SQLite GUI. On Sun, Sep 25, 2016, 14:17 kbman99 wrote: > Ju

  1   2   >