Customize models and dashboard to add an editable entity type to product class

90 views
Skip to first unread message

Cornel Vaideanu

unread,
Oct 5, 2017, 10:23:19 AM10/5/17
to django-oscar
Hello

   I am new to Oscar Commerce, for the project that I am currently working on I need to create a "Vendor" model that can be added as an attribute to products. The docs are not very clear and I need your help with the following questions:

1. The Vendor model should have some basic fields, the code for it should go into a new app ?
2. How can I make the Vendor model editable from dahsboad ?
3. I created a new product class from admin and added a new attribute of type entity, how can I customize the dashboard product edit page to add the related field ?


thank you

Ryan Harrigan

unread,
Oct 5, 2017, 10:33:06 AM10/5/17
to django...@googlegroups.com
Hello Cornell

I am new to Oscar as well. 

The Vendor class seems exactly what a Partner is. All products are related to Partners through StockRecords (AbstractStockRecord). Use Partners for your Vendors. I think this should then be editable from the Dashboard as well.

I'm not sure what you mean in 3). "attribute of type entity". I think you may need to overload the Oscar dashboard.catalogue files to edit custom fields for Products.

Best,

Ryan

--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/django-oscar.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/bd10b984-9338-45be-91fd-c483fbb0d571%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cornel Vaideanu

unread,
Oct 5, 2017, 10:53:05 AM10/5/17
to django-oscar
Hi Ryan,

   Thank you for your answer, for 1) and 2) I want to create a new Vendor model, I don't want to use the existing ones.

3) Attribute of type entity can be created on product type edit page: "/dashboard/catalogue/product-type/1/update/#product_attributes"   and I want to make the required functionality and UI to make it editable from Product edit page: "/dashboard/catalogue/products/1/?#product_attributes"


best regards,
Cornel

Ryan Harrigan

unread,
Oct 6, 2017, 11:24:10 AM10/6/17
to django...@googlegroups.com
If you want to make the name "Partner" into "Vendor" you can overload the verbose_name and verbose_name_plural options for Partner. Otherwise, you will need to re-write the Partner code

class Partner(AbstractPartner):
    class Meta:
        verbose_name = _("Vendor")
        verbose_name_plural = _("Vendors")




product type is actually a catalogue.ProductClass, so keep that in mind and probably overload ProductCreateUpdateView in dashboard.catalogue views.py




--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/django-oscar.

Cornel Vaideanu

unread,
Oct 10, 2017, 8:43:36 AM10/10/17
to django-oscar
Thank you for your answer, I want to keep Partner and create 2 new ones: Vendor and Distributor, how do you suggest to approach this ?
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.

mykl john

unread,
Oct 18, 2017, 2:11:09 AM10/18/17
to django-oscar
Depending on what you want to do with them, you can fork the Catalogue App and add them to models.  Or you can create your own app (add it to settings)

To create your own, and add the templates to the dashboard and everything, clone Partners (the parts you need) from apps, apps/dashboard, and templates to your new folder and make your changes.  At a minimum, you'll need app.py, models.py, forms.py.  You'll have to change all the relational fields.  And when you have the models the way you want, you'll need to migrate them to the dbase. That should get you started.
Reply all
Reply to author
Forward
0 new messages