Re: Running django on demand via my PyQt4 Standalone app

2016-10-24 Thread Gergely Polonkai
Hello, I think installing Django purely for its ORM is a huge overkill. Why not, for example, SQLAlchemy? Or Qt's own DB layer (I'm making an educated guess here; if GTK has one, maybe Qt has its own, too.) If you actually want to use the web framework functionality, though, that's another story,

Re: Django and Lynda.com

2016-10-13 Thread Gergely Polonkai
Hello, assuming you created the models.py file and filled it with model classes, the only thing I can think of is you haven't added your own app to the INSTALLED_APPS variable in settings.py Hope that helps. Best, Gergely On Fri, Oct 14, 2016, 03:37 Paul Handley wrote: > I am taking the Djang

Re: How to populate a JqGrid in Django with data obtained from a query (queryset)

2016-09-25 Thread Gergely Polonkai
Hello, do you already know how to do it without Django, e.g with a static dataset? Because, from the HTML page's view, you will exactly do that. I don't know JqGrid, but I assume it needs an array of objects, like gridData = [ { firstColumn: 1, secondColumn: "data" },

Re: How can I send a password recovery e-mail to a Customer/User in Django?

2016-09-25 Thread Gergely Polonkai
Hello, the trick is not in the email sending, but in resetting the password. Assuming you don't use any user managing apps (as you didn't state it), you will have to implement some parts, but the built-in auth module[1] already covers a lot of this. Best, Gergely [1] https://docs.djangoproject.

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

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

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

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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-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: 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: 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: 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: 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: 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: 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-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-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-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: Can not read request.body from a POST request

2016-04-21 Thread Gergely Polonkai
A JSON/XML payload, for example. If you use plain Django (on DRF and other extensions), then request.body is the only way to access said payload. Best, Gergely Gergely Polonkai [image: https://]about.me/gergely.polonkai <https://about.me/gergely.polonkai?promo=email_sig&utm_source=em

Re: remove ./ from commands

2016-04-21 Thread Gergely Polonkai
oject/lives:$PATH" After this one, you can enter plain manage.py 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-04-21 6:46 GMT+02:00

Re: Can not read request.body from a POST request

2016-04-20 Thread Gergely Polonkai
read its body? Best, Gergely They aree [image: --] Gergely Polonkai [image: https://]about.me/gergely.polonkai <https://about.me/gergely.polonkai?promo=email_sig&utm_source=email_sig&utm_medium=external_link&utm_campaign=chrome_ext> Gergely Polonkai [image: https://]about.m

Re: Migrating older 1.4 project to 1.9

2016-03-30 Thread Gergely Polonkai
I have already suggested this approach to someone with a similar problem: upgrade one version at a time. I’m sure it is possible to find older versions; 1. upgrade to the next minor release (1.4 => 1.5, etc), 2. do the necessary adjustments, 3. goto 1. It may be a lot of work, but at the end of th

Re: testing django migrations

2015-12-27 Thread Gergely Polonkai
I'm also interested in that, except that I'd like to test RunPython steps. On Dec 28, 2015 12:32 AM, "Dan Tagg" wrote: > Hi, > > I used this: > https://github.com/plumdog/django_migration_testcase > > It's only worth writing tests if you are modifying code created by > makemigrations. > > Dan > >

Re: calling html file from within javascript

2015-12-13 Thread Gergely Polonkai
Best, Gergely On Dec 14, 2015 7:52 AM, "Gergely Polonkai" wrote: > Hello, > > although this is barelyDjango related, here are some notes. > > From MDN[1]: Note: as* document.write* writes to the document *stream*, > calling *document.write* on a closed (loaded) document aut

Re: calling html file from within javascript

2015-12-13 Thread Gergely Polonkai
Hello, although this is barelyDjango related, here are some notes. >From MDN[1]: Note: as* document.write* writes to the document *stream*, calling *document.write* on a closed (loaded) document automatically calls *document.open* which will clear the document

Re: Problem Working with forms.Form

2015-12-06 Thread Gergely Polonkai
Hello, you should use ModelForm; if the only problem you have is the CSS properties, you may assign custom CSS classes to your widgets, and use templates to render your fields individually. Best, Gergely On Dec 6, 2015 5:33 PM, "Teddy McZieuwa" wrote: > Hi, > please, I am new to django, I just

Re: Recursion error after upgrading from 1.8 to 1.9

2015-12-02 Thread Gergely Polonkai
New info: I have removed everything after django.contrib.staticfiles, but the problem still persists. 2015-12-02 11:57 GMT+01:00 Gergely Polonkai : > I have upgraded Django from 1.8.5 to 1.9. Running my tests fails with this: > > RuntimeError: maximum recursion depth exceeded while

Recursion error after upgrading from 1.8 to 1.9

2015-12-02 Thread Gergely Polonkai
I have upgraded Django from 1.8.5 to 1.9. Running my tests fails with this: RuntimeError: maximum recursion depth exceeded while calling a Python object My INSTALLED_APPS: INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.con

Re: Fixed column width in admin interface?

2015-11-14 Thread Gergely Polonkai
Or you can apply a CSS with overflow: ellipsis; whichever fits you. On 14 Nov 2015 17:10, "Simon Charette" wrote: > Hi Jorgue, > > You can simply define a `list_display` method > > that truncat

Re: Django on CentOS

2015-11-09 Thread Gergely Polonkai
Hello, there’s a lot that is not clear for me in your included config: • Why are all those paths in WSGIPythonPath? • Are there Python modules in those directories? • Do I get it right that your application is installed under /var/www (which is generally a bad idea)? • Is pizzaclub/settings.py av

Re: Django on CentOS

2015-11-08 Thread Gergely Polonkai
Hello, no, the problem is here: [Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] ImportError: Could not import settings 'pizzaclub.settings' (Is it on sys.path?): No module named pizzaclub.settings, referer:http ://212.227.107.82/ It see

Re: Managing and synchronising users on multiple sites

2015-11-08 Thread Gergely Polonkai
separate one would be the best) On 8 Nov 2015 21:09, "Stodge" wrote: > The servers are in DMZs in different cities. I don't control the firewall > configuration and I'm not allowed to open extra ports. > > On Sunday, 8 November 2015 14:18:37 UTC-5, Gergely Polon

Re: finding information on modules, imports, etc.

2015-11-08 Thread Gergely Polonkai
It's a bit unclear what you want to do. Could you write a use case? I'm afraid of an XY problem here… On 8 Nov 2015 18:25, "Gary Roach" wrote: > I can't seem to find a "dictionary" of modules? or what ever on the use of: > > import os or other possible imports > > from django.contrib import admi

Re: Managing and synchronising users on multiple sites

2015-11-08 Thread Gergely Polonkai
How about an SSO solution hosted at one of the sites? When the user logs in, the site authenticates them against the SSO, and fetches user data. See Stack Exchange sites (Stack Overflow, Server Fault, etc) as an example. On 8 Nov 2015 18:24, "Stodge" wrote: > I have several Django sites and I nee

Re: coding in template

2015-11-07 Thread Gergely Polonkai
That depends on your text editor. Most of them make it possible to choose an encoding in the save dialog. 2015-11-07 21:56 GMT+01:00 Dariusz Mysior : > How can I save in other coding, I had only option "save as" and name of > file index.html > > W dniu sobota, 7 listopada 2015 21:44:25 UTC+1 użyt

Re: coding in template

2015-11-07 Thread Gergely Polonkai
Hello, I guess seems that your template is saved in LATIN2 encoding (in which 0xb3 is ł). Save it in UTF-8, or set up Django to use LATIN2 as the encoding instead of Unicode (I suggest to go with the first option, though). Best, Gergely 2015-11-07 21:44 GMT+01:00 Dariusz Mysior : > I try use po

Re: How do I relate two tables using field name instead of id?

2015-11-05 Thread Gergely Polonkai
If you go with the current solution, you will have to add the to_field keyword argument to ForeignKey: clinician = models.ForeignKey(Clinician, to_field='name') Best, Gergely 2015-11-05 15:47 GMT+01:00 frocco : > Thanks, I will look into adding id > > If I just do this, clinician = models.Forei

Re: How do I relate two tables using field name instead of id?

2015-11-05 Thread Gergely Polonkai
It is possible, but in an SQL database it may become ineffective. For this, you will have to make the name field unique, and put an index on it (uniqueness also creates an index, by the way). For the admin site to display names, though, you still have to define the __str__() method that does only

Re: How do I relate two tables using field name instead of id?

2015-11-04 Thread Gergely Polonkai
This really depends on the structure of your models. In this case you will most likely have a ForeignKey in one of your models; if the referenced model has an __str__() method, the admin site (and also any other forms) will display names instead of the text "OtherModel object". On 4 Nov 2015 17:19,

Re: Best practices for writing functional tests to exercise forms?

2015-11-04 Thread Gergely Polonkai
An even more fine grained solution may be using an HTML parser like beautifulsoup. However, if your site's functionality depends on client side features like JavaScript, Selenium may be a better alternative. On 4 Nov 2015 18:33, "Dheerendra Rathor" wrote: > You can use unittest.TestCase.assertReg

Re: can I write Django a client consuming RESTfull api from elsewhere

2015-11-04 Thread Gergely Polonkai
On 4 Nov 2015 17:31, "kk" wrote: > > > Ok one question, > I would like to store a client connection in some kind of a global place for my entire Django frontend. > So that the request object can be used from any view. > Can you suggest some guideline to do this? > Happy hacking. > Krishnakant.

Re: can I write Django a client consuming RESTfull api from elsewhere

2015-11-03 Thread Gergely Polonkai
On 4 Nov 2015 05:45, "kk" wrote: > > > > On Tuesday 03 November 2015 08:35 PM, Remco Gerlich wrote: >> >> Django code is just normal Python. Python can call REST APIs, sure (a nice library is Requests: docs.python-requests.org/en/latest/ ) >> > I got to see this, thanks, had a quick look and it e

Re: [1.8] Odd error on makemigrations when moving model to another application

2015-11-02 Thread Gergely Polonkai
On 3 Nov 2015 06:07, "Mike Dewhirst" wrote: > > On 3/11/2015 9:55 AM, Alex Heyden wrote: >> >> I tried putting the model back in its original module with some much smaller changes, but I'm getting the same error. The error is nonsense in the current context. >> >> Is there some intermediate state

Running migrations on the non-default database fails

2015-10-28 Thread Gergely Polonkai
Hello, I have an application which, due to low usage, used SQLite in production. Now the demand has risen for the app, and SQLite can't really keep up with with all the new users. We decided to move to PostgreSQL. The DB is now up and running, but to cause as short downtime as possible, I added a

Re: Keep object along a session.

2015-10-20 Thread Gergely Polonkai
Hello, in the runserver environment, each request is served by the same instance, so whatever object you create and leave referenced somehow (good luck on that) will stay alive until runserver is running. However, as soon as you move to a production environment, be it Apache's mod_python, gunicorn

Re: Importing models from another app?

2015-10-17 Thread Gergely Polonkai
How does it fail, what is the error message? My first guess is that you should omit "mysite" from your import line, but without the exact message it's hard to tell. Best, Gergely On 17 Oct 2015 15:52, "svewa" wrote: > Hello everyone, > > I have a question about the model interaction between diff

Re: Reverse access model through a “double” ForeignKey

2015-10-14 Thread Gergely Polonkai
to change my templates and such. Thanks for the tips, though! Best, Gergely 2015-10-14 15:09 GMT+02:00 Carsten Fuchs : > Am 14.10.2015 um 11:11 schrieb Gergely Polonkai: > >> This setup, though, doesn’t feel right, as it contains redundancy. Is >> there a way to >> a

Reverse access model through a “double” ForeignKey

2015-10-14 Thread Gergely Polonkai
Hello, I have three models: • Build • BuildGrouping, with a ForeignKey “build” pointing to Build • Value, with a ForeignKey “grouping” that points to BuildGrouping Right now, I also have Value.build, which is a ForeignKey to Build, so I can access the list of Values directly from a Build. This

Re: How to run all tests in INSTALLED_APPS with the new test runner 1.6?

2015-10-06 Thread Gergely Polonkai
is accomplished by grabbing the old > django.test.simple.DjangoTestSuiteRunner from git history or by any other > means. > > On Tuesday, October 6, 2015 at 4:24:00 PM UTC-4, Gergely Polonkai wrote: >> >> Hello, >> >> do you mean the integrated unittest module, o

Re: How to run all tests in INSTALLED_APPS with the new test runner 1.6?

2015-10-06 Thread Gergely Polonkai
Hello, do you mean the integrated unittest module, or the Django test runners? However, both needs to be fetched from old history, and I daresay it won't be an easy fetch. 1.6 code will more than likely be incompatible with 1.8, so even if you backmerge it, you will have to do a lot of patching.

Re: Foriegn key error--> no such column: eduplus_choice.question_id

2015-09-30 Thread Gergely Polonkai
Did you run your migrations? On 30 Sep 2015 15:35, "Bhanu Kathuria" <001kathuriabh...@gmail.com> wrote: > Settings,admin and model file are attached. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop

Re: Foreign key in sqlite3

2015-09-30 Thread Gergely Polonkai
Assuming you are using Django and it's ORM, the same way as in any other database: fieldname = models.ForeignKey(AnotherModel) On 30 Sep 2015 15:18, "Bhanu Kathuria" <001kathuriabh...@gmail.com> wrote: > I am using sqlite3 database. > How can I add foreign key between two tables. > > -- > You

Re: Admin: Unknown fields

2015-09-28 Thread Gergely Polonkai
Hello, I suspect you didn't make/run migrations: python manage.py makemigrations python manage.py migrate The first command creat the so-called migration files that are required to update the database by adding new tables and fields, while the second one does the actual upgrade. Also, allow me

Re: django query, order results such that th128 > th99

2015-09-27 Thread Gergely Polonkai
Hello, what you want to achieve is called "natural order sorting" which is not built into any common SQL implementation I know. You have to do it manually from code, or, if you have to do pagination, add a sorting column that is numeric (and indexed). Best, Gergely On 28 Sep 2015 08:42, "gintare"

Re: Django Tutorial(Database Setup Question)

2015-09-27 Thread Gergely Polonkai
Hello, that message is clear: line 45 in your settings.py has a syntax error. That line, however, seem OK, so I guess the previous one is that; maybe a comma is missing. Best, Gergely On 27 Sep 2015 14:26, "Cai Gengyang" wrote: > Hi Tom, > > Following your latest instructions , I have posted my

Re: NoReverseMatch error in django 1.8

2015-09-27 Thread Gergely Polonkai
Hello, the bookp route requires a user and a book_id parameter. Unless you supply that, your {% url %} tag won't match. Best, Gergely On 27 Sep 2015 12:49, "hossein" wrote: > this is my views and url.py > as long as use tag in my template show error > > url > > urlpatterns = [ > url(r'^boo

Re: NOOB exposes CSRF token. Now what?

2015-09-25 Thread Gergely Polonkai
Hello, you may force-push a new commit that removes the settings file from the GitHub repo, but if you are really paranoid, you may want to change your CSRF token in production immediately. It may cause some temporary annoyance to your users, but nothing long-term. Best, Gergely 2015-09-25 8:03

Re: Create a view form capable of saving data into models through FK

2015-09-24 Thread Gergely Polonkai
Hello, The most beautiful way (IMHO) is to create a widget type for this. See this answer on SO[1]. I wonder why this is not part of Django yet… [1] http://stackoverflow.com/a/5155576/1305139 On 25 Sep 2015 01:53, "eli" wrote: > Hi Guys, > A noob here, > > I have two models, > > class Students(

Re: custom setting provided by myapp

2015-09-23 Thread Gergely Polonkai
Hello, Most apps I know don't do such things. They write everything needed for them to work in their docs, and if something is not set, they either work with a sane default, or raise ImproperlyConfigured. I do the same myself. Also, Python does this in general; it assumes you read the manual befo

Re: Django error report not being sent through email

2015-09-19 Thread Gergely Polonkai
It belongs to settings.py, as everything else. However, if you haven't overridden it, it should send yeu the emails. Are you sure your e-mail sender settings are set properly? Best, Gergely On 19 Sep 2015 14:27, "Xin Ji" wrote: > No, I haven't. > How should I override? And Which file should I pu

Re: Django error report not being sent through email

2015-09-19 Thread Gergely Polonkai
Hello, BrokenLinkEmailsMiddleware sends error reports about 404 errors. 500 errors are reported via logging. Have you overridden the LOGGING setting? Best, Gergely 2015-09-19 13:49 GMT+02:00 Xin Ji : > I'm using apache + django + mod_wsgi to serve my app. > My apache version is 2.4.7 and my dj

Re: Best way to trigger javascript function when returning a page from django view

2015-09-19 Thread Gergely Polonkai
Hello, I can't see the use case here. If you are submitting the form with AJAX, why would you store it? Or, if I misunderstood you and you submit in the non-AJAX way, Django will send give you back your filled form with the validation errors. Best, Gergely On 19 Sep 2015 10:09, "Martin Torre Cast

Re:

2015-09-19 Thread Gergely Polonkai
Hello, 0) learn to use Google. Getting the following two links took about 12 seconds 1) if you want to contribute to Open Source in general, go to [1] 2) if you want to contribute to Django specifically, go to [1], then go to [2] 3) profit! Best, Gergely [1] http://developer.com/open/how-to-star

Re: What frontend-tools to use for a new CRM project? Shall I use Django OR switch to Meteor.js?

2015-09-09 Thread Gergely Polonkai
Hello, this is a bit off topic here, and highly opinion based, but here are my two cents: I got along very well with both Bootstrap and Angular, but never tried React before. However, a quick Google search shows that React is barely supported yet (in terms of available Django apps). Best, Gergely

Re: What frontend-tools to use for a new CRM project? Shall I use Django OR switch to Meteor.js?

2015-09-09 Thread Gergely Polonkai
a website that consists of > both an application part and an static website.* > > > > > *What do you guys think of Django in combination with React.js?Are there > good tutorials out there to make it work and get me started?Or is there > another framework you can recon?* > Ki

Re: What frontend-tools to use for a new CRM project? Shall I use Django OR switch to Meteor.js?

2015-09-08 Thread Gergely Polonkai
Hello, this all depends: if I'm a JS expert, I'd go with Meteor or another JS framework. If I'm a Python expert, I'd go with Django or another Python framework. Meteor's strength is in the fact that (almost) the same code runs on the server and in the browser (wether it's good or not is another s

Re: What are the disadvantages of using a custom user model?

2015-08-30 Thread Gergely Polonkai
Hello, is it the fields or the functionality you don't need? If it is really the functionality, you shouldn't bother; just don't use it. If some of the fields, then it worths an evaluation on why you don't need them, if you will have only a few users (e.g. a company internal app), then again, don'

Re: Notify Customer Support of Request Failures

2015-08-30 Thread Gergely Polonkai
Hello, in a default Django installation the 500 responses are handled by the logger, not a middleware. It is possible to write a middleware that captures all error responses, and sends a mail about each of them (or only if they are relevant). I don't know of any that is already written, but based

Re: Django Live Site to Localhost (Testing)

2015-08-25 Thread Gergely Polonkai
If this is a Django-only thing, you can use manage.py to dump and load your data, without the SQL dump. The code, I guess, is available from somewhere, e.g. in a VCS so you just have to clone/checkout. On 20 Aug 2015 16:40, wrote: > We have a completely developed Django Site running on live, But

Re: how to access the parent instance from the Inline model admin?

2015-08-23 Thread Gergely Polonkai
Whose parent do you want to get? The inline, the model, or, less likely, the form? On 23 Aug 2015 16:48, "Michael" wrote: > How can I access the parent instance from the inline model admin? > > My goal is to allow to add a child object only when the status of the > parent is equal to 1 so I'm try

Re: Console Routes With Django ??

2015-08-11 Thread Gergely Polonkai
Not really. Management commands available in Django can't modify database content as console routes does. Think about them as having a CRUD view set that you can only call via a management command. On 12 Aug 2015 01:23, "Tom Lockhart" wrote: > > On Aug 11, 2015, at 12:29, Prabath Peiris > wrote:

Re: Console Routes With Django ??

2015-08-11 Thread Gergely Polonkai
Hello, as far as I know, Django doesn't have thin functionality built in. I would be interested in such an app, though… Best, Gergely On 11 Aug 2015 21:30, "Prabath Peiris" wrote: > Hi > > I am new to (kind of) Django framework and just finish the > Django-REST-framework tutorials and it looks

Re: Using FormMixin with DetailView

2015-07-27 Thread Gergely Polonkai
Forgot to add, the full backtrace would be helpful, too. It should be present on the same error page. On 28 Jul 2015 08:52, "Gergely Polonkai" wrote: > Hello, > > could you show us the relevant part of your urls.py file? I suspect view > parameters to cause the trouble b

Re: Using FormMixin with DetailView

2015-07-27 Thread Gergely Polonkai
Hello, could you show us the relevant part of your urls.py file? I suspect view parameters to cause the trouble but I'd like to be sure. Best, Gergely On 28 Jul 2015 00:46, "Ioannis Latousakis" wrote: > I am on the exact same situation as the one described in the documentation > here: > https:/

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

  1   2   >