Help with FlatPages

2016-09-19 Thread Lekan Wahab
Good morning guys, I'm trying to locally set up an existing project on my machine. While I've set up most of the project, the part giving me a hard time are the ones using flatpages. Now, everytime I access those, I get a "No Flatpages matches the given query. " error. I've tried everything

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Asad Jibran Ahmed
I'd need to see the full Cart model to confirm, but try something like this to get all products for Orders with the paid status: def get_products(self): orders = Order.objects.filter(user=self.user, status='paid') products_list = list() for o in orders: for p in o.cart.products: products_l

Re: Setting FK field in list view

2016-09-19 Thread RompePC
Ok, looks like just adding a *ModelForm* and getting that field does the work. Sorry for the noobish time. El martes, 20 de septiembre de 2016, 8:23:19 (UTC+2), RompePC escribió: > > Talking in the way of getting the HTML widget yeah, maybe. But what I > wanna do is, given a model *A* with a FK

Re: Setting FK field in list view

2016-09-19 Thread RompePC
Talking in the way of getting the HTML widget yeah, maybe. But what I wanna do is, given a model *A* with a FK *a_fk*, I want *a_fk* to be available in views other than add. So I wanna get *a_fk* and pass it to another context ( *changelist_view* specifically). But the nearest thing I get is *se

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Shamaila Moazzam
user = models.ForeignKey(settings.AUTH_USER_MODEL) this user is a F.K in products model, orders model , carts model right. cart is also a F.K in orders like this class Order(models.Model): status = models.CharField(max_length=120, choices=ORDER_STATUS_CHOICES, default='created') cart = m

Re: Django filters with Foreign Key

2016-09-19 Thread A.Khan
> > Happy to see we are in same boat. It did work with like: > def prod_sold(self): prod = self.get_prod().filter(seller__user=self.account.user) sold = Order.objects.filter(id=products) return sold But it only shows number of products sold. I couldn't make it happen. I

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Asad Jibran Ahmed
Can you share the Cart model? The Order has a foreign key to Cart. I think that may be the model holding details of the products. On Tuesday, September 20, 2016 at 9:32:12 AM UTC+4, Asad Jibran Ahmed wrote: > > How are you associating a product with an order? Is there a way to get a > list of pr

Re: Django filters with Foreign Key

2016-09-19 Thread Shamaila Moazzam
Hi , i am having the same problem ..with my sellers App . can you share your solutionthat how you filter regards On Monday, September 19, 2016 at 5:27:31 PM UTC+5, A.Khan wrote: > > I just got it done. > > Thanks. > > On Mon, Sep 19, 2016 at 4:19 AM, Ali khan > wrote: > >> I've tried

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Asad Jibran Ahmed
How are you associating a product with an order? Is there a way to get a list of products sold for each order? Asad Jibran Ahmed http://blog.asadjb.com On Tue, Sep 20, 2016 at 9:24 AM, Shamaila Moazzam < shamaila.moaz...@gmail.com> wrote: > Thanks for you kind response ...I am stuck in it :( >

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Shamaila Moazzam
Thanks for you kind response ...I am stuck in it :( I have seller as a foreign key in Product model.. *products/models.py* class Product(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL) seller = models.ForeignKey(SellerAccount) title = models.CharField(max_length

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Asad Jibran Ahmed
Hi, While you didn't show us the Product model, I assume it has a ForeignKey to the Order model. To filter for Products that have an Order with a sold status, you should look at the documentation for filtering on relationships at https://docs.djangoproject.com/en/1.10/topics/db/queries/#lookup

Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Shamaila Moazzam
hi I am a beginner in django/python * :(* I am making a dashboard of sellers App. I am stuck in filtering orders of the products according to the logged in user(seller) *sellers/models.py* from django.conf import settings from django.core.urlresolvers import reverse from django.db import mo

Re: Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied

2016-09-19 Thread premdjango
prem compiler sql == SELECT "django_migrations"."app", "django_migrations"."name" FROM "django_migrations" prem compiler params == () prem debugwrapper== prem debugwrapper== ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute

covert julian date to calander date

2016-09-19 Thread sum abiut
Hi, how to you convert from Julian date to a Calender date. I am pulling data from an MSSQL and i what to convert the Julian date to calender date before displaying data on my template. cheer -- You received this message because you are subscribed to the Google Groups "Django users" group. To u

django group authentication

2016-09-19 Thread 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 -- You received this message because you are subscri

Howto to create custom admin commands with subcommands

2016-09-19 Thread anton
Hi, is there an possibility to use https://docs.python.org/3/library/argparse.html#sub-commands in the custom admin commands so I can have subcommands like manage.py mycommand subcommand1 choice1-for-subcommand1 manage.py mycommand subcommand1 choice2-for-subcommand1 manage.py mycommand subcomma

Re: How to do a generic field in an app.

2016-09-19 Thread Tim Graham
Do you know about https://docs.djangoproject.com/en/stable/ref/contrib/contenttypes/#generic-relations ? On Monday, September 19, 2016 at 12:30:01 PM UTC-4, Jonty Needham wrote: > > I want to have a model that has a foreignkey to a model from another app. > The app can be one of many. > > So f

Re: Setting FK field in list view

2016-09-19 Thread Tim Graham
So basically ModelAdmin.list_editable but without the icons on the side? If you never want the inline editing buttons for all models, you could override the admin/related_widget_wrapper.html template and remove the buttons. https://github.com/django/django/blob/master/django/contrib/admin/templa

Re: Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied

2016-09-19 Thread Tim Graham
Can you print query and params where the error happens? On Monday, September 19, 2016 at 12:56:12 PM UTC-4, premdjango wrote: > > Im trying to run the tests in Django but get the following error. > > > (djangodev) Anands-MacBook-Pro:tests premlaks$ ./runtests.py > --settings=test_sqlite requests

Re: Setting FK field in list view

2016-09-19 Thread RompePC
Yeah, I'm so sorry, it's hard to understand. I'll post an image of the Django tutorial of what I mean: I want that the FK widget (the one for *Question*) could be avail

Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied

2016-09-19 Thread premdjango
Im trying to run the tests in Django but get the following error. (djangodev) Anands-MacBook-Pro:tests premlaks$ ./runtests.py --settings=test_sqlite requests File "/Users/premanandlakshmanan/Documents/django-contribute/django/django/db/models/query.py", line 1072, in _fetch_all sel

Re: Setting FK field in list view

2016-09-19 Thread Tim Graham
I still don't understand the goal. Maybe you can mock up a screenshot and/or give a code example. On Monday, September 19, 2016 at 12:41:32 PM UTC-4, RompePC wrote: > > Nope, as I wanna the ModelChoiceField rendered in the filter list I did in > my own (not the sided one). > > El lunes, 19 de se

Re: Setting FK field in list view

2016-09-19 Thread RompePC
Nope, as I wanna the ModelChoiceField rendered in the filter list I did in my own (not the sided one). El lunes, 19 de septiembre de 2016, 18:15:17 (UTC+2), Tim Graham escribió: > > ModelAdmin.list_editable? > > > https://docs.djangoproject.com/en/stable/ref/contrib/admin/#django.contrib.admin.Mo

How to do a generic field in an app.

2016-09-19 Thread Jonty Needham
I want to have a model that has a foreignkey to a model from another app. The app can be one of many. So far I've come up with a two field solution with: model_type = ForeignKey(ContentType) pk_field = PositiveIntegerField() with an appropriate getter. Is there a better way to do this? It feels

Re: Setting FK field in list view

2016-09-19 Thread Tim Graham
ModelAdmin.list_editable? https://docs.djangoproject.com/en/stable/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_editable On Monday, September 19, 2016 at 11:05:22 AM UTC-4, RompePC wrote: > > Nope, it isn't a lookup separator: for simply understanding, I wanna get > the FK widget (the

Re: Setting FK field in list view

2016-09-19 Thread RompePC
Nope, it isn't a lookup separator: for simply understanding, I wanna get the FK widget (the HTML, the select, all of that) that is show when adding an object that has a related key (say, adding a new City and selecting its Country in the same model, 'cause a City belongs to a Country) so I can

Re: A public cloud with django backend

2016-09-19 Thread 'Tom Evans' via Django users
On Thu, Sep 15, 2016 at 8:21 AM, Rahul Doshi wrote: > 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 jus

Re: Newbie to Novice – Using Admin DateTime Picker in your Form

2016-09-19 Thread Mayank Rungta
I am looking at making custom forms look like Django admin forms with the widgets in place. Also, I like to do a similar thing for displaying tables. I used a combination of plugins for sorting, filters and displaying tables with pagination. The result was not as good. What I am hoping is to find a

Re: Newbie to Novice – Using Admin DateTime Picker in your Form

2016-09-19 Thread Nate Granatir
Just realized this thread was not necessarily about filters for the admin; in the case of using custom forms/views Django daterange filter may not be a good option. On Thursday, March 19, 2009 at 8:37:56 AM UTC-5, Paul Nema wrote: > > I've noticed many people new to Django (and sometimes also ne

Re: Setting FK field in list view

2016-09-19 Thread Tim Graham
Is your request https://code.djangoproject.com/ticket/10743? On Monday, September 19, 2016 at 10:08:59 AM UTC-4, RompePC wrote: > > Yep, the second one is what I wanna do. Althrough they aren't inlines, but > like FK filter choices in the list view (not the default ones). > It's hard to understan

Re: Newbie to Novice – Using Admin DateTime Picker in your Form

2016-09-19 Thread Nate Granatir
I just installed Django Daterange Filter 1.3.0 (https://github.com/DXist/django-daterange-filter) on a Django 1.9 project. Took a little CSS fiddling to get it to display properly with Grappelli, but other than that it worked like a charm. Nate On Thursday, March 19, 2009 at 8:37:56 AM UTC-5,

Re: Setting FK field in list view

2016-09-19 Thread RompePC
Yep, the second one is what I wanna do. Althrough they aren't inlines, but like FK filter choices in the list view (not the default ones). It's hard to understand, I know it can be done, but don't know how. Will keep searching and throw some light here when done. El lunes, 19 de septiembre de 20

Re: How to populate self._reverse_dict with a default language code ?

2016-09-19 Thread Etienne Robillard
I created a ticket and patch for this issue: https://code.djangoproject.com/ticket/27243 I guess my urlpatterns was improperly configured... However, the real problem was that reverse() didn't handle fully qualified module names. Regards, Etienne Le 2016-09-18 à 19:14, Mike Dewhirst a écr

Re: authenticate user on post request returns 403-regarding

2016-09-19 Thread sabari rangan
the view is @api_view(['POST']) def example(request): return Response({'usernmae': request.user.username},status=status.HTTP_200_OK) when i print the content of response object it shows b'{"detail":"CSRF Failed: CSRF cookie not set."}' it happens only when i set sessionid cookie in client

Re: Django filters with Foreign Key

2016-09-19 Thread Ali khan
I just got it done. Thanks. On Mon, Sep 19, 2016 at 4:19 AM, Ali khan wrote: > I've tried many ways but it ends with the same error that says: > > Cannot query "alikhan": Must be "User" instance. > > Where alikhan is admin user I've created with createsuperuser. > > Hate to bother you again but

Re: Setting FK field in list view

2016-09-19 Thread ludovic coues
I looked into it after my first reply and my suggestion was wrong. If you want to display the value of a foreign key object's property in the admin page to select an object to change, you can add a callable to list_display. For exemple, ` list_display = ('title', lambda o: getattr(o.author, "name"

Re: Django filters with Foreign Key

2016-09-19 Thread Ali khan
I've tried many ways but it ends with the same error that says: Cannot query "alikhan": Must be "User" instance. Where alikhan is admin user I've created with createsuperuser. Hate to bother you again but please advise. Regards, Ali On Sun, Sep 18, 2016 at 11:08 PM, James Schneider wrote: >

Re: Issue using django-admin

2016-09-19 Thread Bharathi Raja
As said in docs , your django version may be different, check your system $PATH or try symlinking On Monday, September 19, 2016 at 7:40:50 AM UTC+5:30, PARTH VERMA wrote: > > Hello everyone, > > I am n

Re: Setting FK field in list view

2016-09-19 Thread RompePC
Hi again, I didn't have time to try it until now, but I just realized that maybe I asked the wrong way. What I wanna do is to render the widget associated to that FK in the panel, not its name. So I need to pass the field or its rendered content to the context, but I don't know how to do get it

Re: Issue using django-admin

2016-09-19 Thread Tim Graham
Did you install it as described at https://docs.djangoproject.com/en/dev/topics/install/#installing-the-development-version ? On Sunday, September 18, 2016 at 10:10:50 PM UTC-4, PARTH VERMA wrote: > > Hello everyone, > > I am new to Django and just cloned it. I am getting error running > djang

Re: Random 404 instead of 301 for URLs without trailing slash

2016-09-19 Thread Frederik Elwert
Hi Michal, Am Freitag, 16. September 2016 18:40:11 UTC+2 schrieb Michal Petrucha: > > Hi Frederik, > > On Fri, Sep 16, 2016 at 09:01:53AM -0700, Frederik Elwert wrote: > > Hello, > > > > I am running a site that uses Django 1.8 and Django CMS 3.2. The site is > > deployed using gunicorn and n