ok thanx @ ludovic coues...
i will try this and then tell you
regards
On Thursday, August 18, 2016 at 2:38:46 AM UTC+5, ludovic coues wrote:
>
> Ok, sorry, I made a off by one error on the link :)
>
> Try that:
>
> # shops/admin.py
> from django.contrib import admin
> from products.models im
No idea. I've never looked into model managers.
Maybe they can help in non-repeating code, maybe they won't work due
to the lack of access to the currently logged user.
2016-08-18 12:55 GMT+02:00 M Hashmi :
> Ludovic,
>
> Shouldn't she be using model managers for this?
>
> Just curious.
>
> Regard
Ludovic,
Shouldn't she be using model managers for this?
Just curious.
Regards,
Mudassar
On Wed, Aug 17, 2016 at 2:37 PM, ludovic coues wrote:
> Ok, sorry, I made a off by one error on the link :)
>
> Try that:
>
> # shops/admin.py
> from django.contrib import admin
> from products.model
Ok, sorry, I made a off by one error on the link :)
Try that:
# shops/admin.py
from django.contrib import admin
from products.models import Product
from .models import Shop
class ShopAdmin(admin.ModelAdmin):
def formfield_for_manytomany(self, db_field, request, **kwargs):
if db_field
shops/admin.py
from .models import Shop
admin.site.register(Shop)
products/admin.py
from .models import Product, Variation, ProductImage, Category,
ProductFeatured, color_product, size_product
class ProductImageInline(admin.TabularInline):
model = ProductImage
extra = 0
max_num = 10
clas
On Wednesday, August 17, 2016 at 6:37:51 PM UTC+5, Shamaila Moazzam wrote:
>
> Hi,
>
> I am a beginner and please forgive me if my question is not up to the
> standard. I've got two models one is Product which is saved in db already
> and another one is Shop. I am trying to related both models
Could you share your admin.py file ?
You might be interested into this part of the documentation:
https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_foreignkey
2016-08-17 17:20 GMT+02:00 Shamaila Moazzam :
> @Ludovic there is no error. Just I d
@Ludovic there is no error. Just I don't want to get all the products
pre-populated. I need empty products field and only when user uploads
products then it should show me products. Please advise
On Wednesday, August 17, 2016 at 6:37:51 PM UTC+5, Shamaila Moazzam wrote:
>
> Hi,
>
> I am a beginn
@Mudassar this is exactly what I need.
On Wednesday, August 17, 2016 at 6:37:51 PM UTC+5, Shamaila Moazzam wrote:
>
> Hi,
>
> I am a beginner and please forgive me if my question is not up to the
> standard. I've got two models one is Product which is saved in db already
> and another one is
So what you are saying is that you don't need to get all the products
instead only products uploaded by a particular user?
This makes sense because you are getting the whole model called with the
key so if I am getting your question right you just need to apply some sort
of filter to get user relat
Do you have any error with the code you posted ?
It look like you already have a foreign key to your user.
2016-08-17 15:33 GMT+02:00 Shamaila Moazzam :
> Hi,
>
> I am a beginner and please forgive me if my question is not up to the
> standard. I've got two models one is Product which is saved in
Hi,
I am a beginner and please forgive me if my question is not up to the
standard. I've got two models one is Product which is saved in db already
and another one is Shop. I am trying to related both models with following
code.
class Product(models.Model):
user = models.ForeignKey(setting
12 matches
Mail list logo