Re: Error running WSGI application

2018-06-04 Thread Joseph Mutumi
Hello, Check https://help.pythonanywhere.com/pages/DebuggingImportError/#django-specific-issues And make sure your directory structure is as recommended: /home/myusername `-- myproject/ |-- __init__.py `-- myproject/ |-- __init__.py `-- settings.py If it is not, then

Re: Flask-supermarket forms creation

2018-06-04 Thread Joseph Mutumi
Hello, Check Django formset documentation: https://docs.djangoproject.com/en/2.0/topics/forms/formsets/ For Flask, if you are using WTForms check the using the combination of FieldList with FormField: http://wtforms.simplecodes.com/docs/0.6/fields.html#field-enclosures Though this is a Django

Re: one-to-one GenericRelation best practices

2018-06-04 Thread Joseph Mutumi
Hello, May be you want to subclass GenericForeignKey: class GenericOneToOne(GenericForeignKey): many_to_one = False one_to_many = False one_to_one = True Though have not tried it so YMMV. Kind regards On Thu, May 31, 2018 at 8:59 PM, Vitor Barbosa wrote: > Hello! This is my

Re: Creating Reports in Django Admin Panel

2018-06-04 Thread Joseph Mutumi
Hello, You'll first need to create a custom admin page. Create your view and add it to the urls.py like normal. Then you extend the admin base template and display your aggregation in there: {% extends "admin/base_site.html" %} {% block title %}Stats title{% endblock %} {% block content %}Stats

Re: Django Queries

2018-05-12 Thread Joseph Mutumi
.objects.all() > >>> d[0] > > >>> d[0].document_id > 2 > >>> d[0].title > 'a new title 2' > >>> d[0].description > 'a new description 2' > >>> d[0].document_state > 1 > >>> d[0].storage_file_name > > >>

Re: Django Queries

2018-05-11 Thread Joseph Mutumi
Hello, That's strange what does your people model look like? Notice it will only populate the fields you have defined in the model not the columns of the table in the database. Did you run migrations after adding new fields to the model? $ python manage.py migrate Kind regards On Sat, May 12,

Re: Problem when getting the ID of the record just created

2014-10-13 Thread Joseph Mutumi
Should get the flow instance from the form.save() so: user = User.objects.get(pk=self.request.user.id) flow = form.save() log = Log(user=user, flow=flow, state=1) On Mon, Oct 13, 2014 at 4:13 PM, Daniel Grace wrote: > Hi, > I have problem when getting the ID of the record

Re: Django ユーザー登録について

2014-04-27 Thread Joseph Mutumi
Hi there, I think your problem is you have not initialized attendance that you use at `instance = attendance`. So it is just using the name of your view function which also happens to be 'attendance' and showing you that error. Initialize to model object with the usual:

Re: Order_by on queryset from chained filters not working

2014-04-24 Thread Joseph Mutumi
Just wondering why not cases = cases.order_by('case_number') ? On 4/24/14, Shawn H wrote: > I've a search page that allows users to search for a "ZoningCase" by many > different parameters, some from the ZoningCase object and some from several > > related objects. The

Re: Ajax post problem

2014-04-17 Thread Joseph Mutumi
You could try using $("form").serialize() to get the form inputs in the ajax data. But from the URL it looks like your HTML is somehow rendering badly. The form action is coming out as '/newmarkets/search/ method=' Kind regards On 4/17/14, willyhakim wrote: > Hi everyone? >

Re: How to get database data into a template sidebar

2013-12-03 Thread Joseph Mutumi
Some of the options you have are: 1) CBVs 2) custom template tags: https://docs.djangoproject.com/en/1.5/howto/custom-template-tags/ 3) template preprocessors: https://docs.djangoproject.com/en/1.5/ref/settings/#template-context-processors On 12/2/13, Drew Ferguson

Re: Email Templates and the full website URL

2013-12-03 Thread Joseph Mutumi
the email body. This is > generated and sent in a view function I have. So, how will the http header > get inserted in this flow ? > > Vibhu > > > > On Fri, Nov 29, 2013 at 7:39 PM, Joseph Mutumi <jjmut...@gmail.com> wrote: > >> That could work but isn't it a bit i

Re: Filtering by month doesn't work

2013-11-29 Thread Joseph Mutumi
I think the model is not being saved because no instance is being constructed by the form. Either make call to event_form.is_valid() of event_form.full_clean(), the former being preferred. On Tue, Nov 26, 2013 at 8:30 PM, Leonardo Giordani < giordani.leona...@gmail.com> wrote: > Are you sure

Re: Email Templates and the full website URL

2013-11-29 Thread Joseph Mutumi
That could work but isn't it a bit insecure? I think it will be susceptible to a header injection(http://en.wikipedia.org/wiki/HTTP_header_injection). I would rather create a setting with the domain name in settings.py and then call it from the template or write a custom template tag. On Fri,

Re: Mysterious error messages

2013-09-23 Thread Joseph Mutumi
Don't use Satchmo but looks like `shop_config` is not defined when you context_processors are called? This is because from it looks like it gets the shop_config based on the current site based on the host. If the domain name saved in the admin for the site corresponding to the SITE_ID in your

Re: looking for an apache/system admin master

2013-06-18 Thread Joseph Mutumi
If they are requesting urls that do not exist why are you worried? Just block that IP address in the vhost configuration and continuously monitor the server for strange or unexpected traffic. You can look into something like munin or graphite. On Tue, Jun 18, 2013 at 8:26 PM, MattDale

Re: HTML Source on Browser Rendering

2013-01-06 Thread Joseph Mutumi
Hello, I think you should also check the 'Content-Type' being received client-side in the HTTP headers. You can use something curl or Firebug. On Sun, Jan 6, 2013 at 1:40 PM, Ryoichiro Kamiya wrote: > Hi, > > I'm testing Django template rendering in development

Re: Escape percent sign in QuerySet.extra()

2012-12-02 Thread Joseph Mutumi
Sorry I hadn't seen your comment, have you tried %%% ? On Mon, Dec 3, 2012 at 7:28 AM, Joseph Mutumi <jjmut...@gmail.com> wrote: > I think to escape a % use %% > > > On Sun, Dec 2, 2012 at 1:16 PM, Martin Svoboda > <martin.svob...@gmail.com>wrote: > >>

Re: Escape percent sign in QuerySet.extra()

2012-12-02 Thread Joseph Mutumi
I think to escape a % use %% On Sun, Dec 2, 2012 at 1:16 PM, Martin Svoboda wrote: > Hi, > I want use postgresql pg_trgm module in django. pg_trgm defines special > operator percent sign. How should I escape it in django query extra method? > > # Pure SQL > SELECT

Re: has_perm returns wrong value

2012-11-14 Thread Joseph Mutumi
I believe default permissions created are: add_*, change_* and delete_*. And the format for a permission would be something like: *app_name*.add_* model_name* So what happens when you try: user.has_perm('structures.add_post') user.has_perm('structures.change_post') If you are registering your

Re: Submitting data from a form

2012-09-14 Thread Joseph Mutumi
Hi, Let me give you a code sample that would be hopefully a push in the right direction. Simply follow these steps: 1. Create your model. Its the code interface to your data source (database) 2. Create your form. Forms are used for processing input data (validation, error reporting

Re: form doesn't validate when trying to upload file

2012-09-09 Thread Joseph Mutumi
I'm assuming you are using the forms.ModelForm for your model? Say LicenceForm? class LicenseForm(forms.ModelForm): class Meta: model = License According to the doc you have to pass all relevant QueryDicts to the form __init__ when you are creating a bound instance. In a nutshell

Re: Problem serving files from media directory

2012-08-28 Thread Joseph Mutumi
Hi, Django isn't responsible for serving any kind of static files in production. It is not a web server ! You need to configure the web server you are using to serve the files in that folder. The documentation has a good example conf for Apache:

Re: Dependent Ajax Form Fields

2012-08-27 Thread Joseph Mutumi
Thank you for the help! On 8/27/12, Jani Tiainen <rede...@gmail.com> wrote: > 26.8.2012 21:54, Joseph Mutumi kirjoitti: >> Hello, >> >> If A is a model with ForeignKey relationships to B. What would be the >> best way of rendering two >> selectboxes,

Dependent Ajax Form Fields

2012-08-26 Thread Joseph Mutumi
Hello, If A is a model with ForeignKey relationships to B. What would be the best way of rendering two selectboxes, A and B. The values of B are the values filtered through using the relationship with the selected value of A via an AJAX call. I need to get these values from the DB as well as

Re: ModelMultipleChoiceField with MultiWidget ?

2012-08-26 Thread Joseph Mutumi
Disclaimer - I have never done this before! >From what I see I reckon you will need to create both a custom field and a custom widget! I think so because if you have TextInputs validation may fail on the ModelMultipleChoiceField? I would think you need to override the methods: __init__, clean,

Re: What happens when you use ``select_for_update`` with ``select_related``?

2012-08-23 Thread Joseph Mutumi
I'm not sure but you can look at the generated query and post it to the relevant database mailing list? Go in through: manage.py shell then follow instructions in FAQ https://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running On Mon, Aug 20, 2012 at

Re: Distinct Values in ModelChoiceField

2012-08-23 Thread Joseph Mutumi
@Melvyn Thank you. It actually worked out as you said. It needed a redesign. On Wed, Aug 22, 2012 at 1:44 PM, Sithembewena Lloyd Dube wrote: > @Melvyn, thanks - that makes sense. > > > On Wed, Aug 22, 2012 at 3:18 AM, Melvyn Sopacua wrote: > >> On

Re: How to use Django with Apache and mod_wsgi

2012-08-20 Thread Joseph Mutumi
> > > On Monday, August 20, 2012 11:30:49 AM UTC+2, stikic wrote: > >> httpd.conf file is in the attachment. >> >> 2012/8/20, Joseph Mutumi <jjmu...@gmail.com>: >> > Hello, >> > >> > Could you post the VirtualHost configuration for Apach

Distinct Values in ModelChoiceField

2012-08-19 Thread Joseph Mutumi
Hello, I have a model that has a foreign key field that I want to use in a form as a select box. That particular field at times appears multiple times in the database. How do I make it only have distinct values? This is a snippet, drop down will have repeated values if same color is entered:

Re: How to use Django with Apache and mod_wsgi

2012-08-19 Thread Joseph Mutumi
Hello, Could you post the VirtualHost configuration for Apache? That would greatly help us help you. Regards On Mon, Aug 20, 2012 at 12:30 AM, Seyfullah Tıkıç wrote: > Hello, > > I read the article below. > https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/ > >

Re: authenticate=None mistery: can't authenticate from the web but it works from the command line

2012-08-19 Thread Joseph Mutumi
Hello, I believe its a simple typo! authenticate(user=usuario, password=clave) should be authenticate(username=usuario, password=clave) Regards On Sun, Aug 19, 2012 at 3:35 PM, Jorge Garcia wrote: > Hi there. Im doing my first login form for an existing Django